Skip to content
Snippets Groups Projects
Unverified Commit 58a09b64 authored by Tim Kaune's avatar Tim Kaune
Browse files

Make install location of CMake files a local variable

Replace CMAKE_CURRENT_LIST_DIR in package config file
Remove EXCLUDE_FROM_ALL from tests.
Building of tests can be controlled with the BUILD_TESTING variable.
parent 6be054e6
Branches
Tags
No related merge requests found
......@@ -29,8 +29,6 @@ cmake_minimum_required(VERSION 3.30...${CMAKE_MAXIMUM_SUPPORTED_VERSION})
project(LoadStaticSharedTargets VERSION 1.8.0 LANGUAGES NONE)
include(GNUInstallDirs)
string(COMPARE EQUAL "${CMAKE_PROJECT_NAME}" "${PROJECT_NAME}" IS_TOP_LEVEL)
if (IS_TOP_LEVEL)
......@@ -42,7 +40,7 @@ option(LoadStaticSharedTargets_INCLUDE_PACKAGING "Include packaging rules for Lo
add_subdirectory(src)
if (IS_TOP_LEVEL AND BUILD_TESTING)
add_subdirectory(tests EXCLUDE_FROM_ALL)
add_subdirectory(tests)
endif ()
if (LoadStaticSharedTargets_INCLUDE_PACKAGING)
......
......@@ -23,15 +23,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
if (NOT DEFINED LoadStaticSharedTargets_INSTALL_CMAKEDIR)
set(
LoadStaticSharedTargets_INSTALL_CMAKEDIR
"${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION}"
CACHE
STRING
"Path to LoadStaticSharedTargets CMake files"
)
endif ()
......@@ -51,6 +49,7 @@ configure_package_config_file(
"LoadStaticSharedTargetsConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/LoadStaticSharedTargetsConfig.cmake"
INSTALL_DESTINATION "${LoadStaticSharedTargets_INSTALL_CMAKEDIR}"
PATH_VARS LoadStaticSharedTargets_INSTALL_CMAKEDIR
)
install(
......
......@@ -28,6 +28,6 @@ SOFTWARE.
cmake_minimum_required(VERSION @CMAKE_MINIMUM_REQUIRED_VERSION@...@CMAKE_MAXIMUM_SUPPORTED_VERSION@)
# include(LoadStaticSharedTargets) should work after this
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
list(APPEND CMAKE_MODULE_PATH "@PACKAGE_LoadStaticSharedTargets_INSTALL_CMAKEDIR@")
check_required_components(LoadStaticSharedTargets)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment