From b3021f48c7b3bd746d4af42c459206027abf6331 Mon Sep 17 00:00:00 2001 From: scivision Date: Mon, 22 Apr 2024 13:56:43 -0400 Subject: [PATCH] cache install prefix --- src/lowtran/cmake/options.cmake | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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 "*")