nameof_module/CMakeLists.txt
Balazs Benics 0639b4b0c4
Update, modernize cmakelists (#14)
* remove IS_TOPLEVEL_PROJECT cmake variable from top level

* rework example/CMakeLists.txt with generator expressions

* rework test/CMakeLists.txt with generator expressions

* fix unknown cxx_std_20 on certain cmake versions

* update test_package/CMakeLists.txt with modern cmake
2019-07-31 18:09:26 +02:00

44 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.8)
project(nameof VERSION "0.9.0" LANGUAGES CXX)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake OPTIONAL)
option(NAMEOF_OPT_BUILD_EXAMPLES "Build nameof examples" OFF)
option(NAMEOF_OPT_BUILD_TESTS "Build and perform nameof tests" OFF)
if(NAMEOF_OPT_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(NAMEOF_OPT_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
include(CMakePackageConfigHelpers)
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_include_directories(${PROJECT_NAME}
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION lib/cmake/${PROJECT_NAME})
install(EXPORT ${PROJECT_NAME}Config
NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
DESTINATION .)