Skip to content

Commit

Permalink
build: add MY_MKDIR_ENABLE_INSTALL option (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal authored Jun 19, 2024
1 parent 78c063c commit 1fb5d95
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ project(
LANGUAGES NONE
)

option(
MY_MKDIR_ENABLE_INSTALL "Enable install targets." ${PROJECT_IS_TOP_LEVEL}
)

include(cmake/MkdirRecursive.cmake)

if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
MyMkdirConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
if(MY_MKDIR_ENABLE_INSTALL)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
MyMkdirConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)

install(
FILES
cmake/MkdirRecursive.cmake
cmake/MyMkdirConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/MyMkdirConfigVersion.cmake
DESTINATION lib/cmake/MyMkdir
)
install(
FILES
cmake/MkdirRecursive.cmake
cmake/MyMkdirConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/MyMkdirConfigVersion.cmake
DESTINATION lib/cmake/MyMkdir
)
endif()

0 comments on commit 1fb5d95

Please sign in to comment.