diff --git a/src/lowtran/cmake/options.cmake b/src/lowtran/cmake/options.cmake index ae96a80..f9ff8e7 100644 --- a/src/lowtran/cmake/options.cmake +++ b/src/lowtran/cmake/options.cmake @@ -1,17 +1,10 @@ include(GNUInstallDirs) -# Rpath options necessary for shared library install to work correctly in user projects -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) -set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true) - # Necessary for shared library with Visual Studio / Windows oneAPI set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - # will not take effect without FORCE - # CMAKE_BINARY_DIR for use from FetchContent - set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install top-level directory" FORCE) +if(PROJECT_IS_TOP_LEVEL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${PROJECT_BINARY_DIR}") endif() file(GENERATE OUTPUT .gitignore CONTENT "*")