2019-06-08 09:49:31 +00:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
2018-03-26 12:02:43 +00:00
|
|
|
|
2019-07-25 14:53:56 +00:00
|
|
|
project(nameof VERSION "0.9.0" LANGUAGES CXX)
|
2018-09-04 14:41:01 +00:00
|
|
|
|
2019-07-27 16:51:45 +00:00
|
|
|
include(${CMAKE_BINARY_DIR}/conan_paths.cmake OPTIONAL)
|
|
|
|
|
2019-07-31 16:09:26 +00:00
|
|
|
option(NAMEOF_OPT_BUILD_EXAMPLES "Build nameof examples" OFF)
|
|
|
|
option(NAMEOF_OPT_BUILD_TESTS "Build and perform nameof tests" OFF)
|
2018-09-04 14:41:01 +00:00
|
|
|
|
|
|
|
if(NAMEOF_OPT_BUILD_EXAMPLES)
|
2019-07-31 19:48:50 +00:00
|
|
|
add_subdirectory(example)
|
2018-09-04 14:41:01 +00:00
|
|
|
endif()
|
2018-03-27 09:03:12 +00:00
|
|
|
|
2018-09-04 14:41:01 +00:00
|
|
|
if(NAMEOF_OPT_BUILD_TESTS)
|
2019-07-31 19:48:50 +00:00
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(test)
|
2018-09-04 14:41:01 +00:00
|
|
|
endif()
|
2019-04-23 13:18:39 +00:00
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
add_library(${PROJECT_NAME} INTERFACE)
|
2019-06-08 09:49:31 +00:00
|
|
|
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
|
|
|
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
|
2019-04-23 13:18:39 +00:00
|
|
|
target_include_directories(${PROJECT_NAME}
|
2019-07-31 19:48:50 +00:00
|
|
|
INTERFACE
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>)
|
2019-04-23 13:18:39 +00:00
|
|
|
|
|
|
|
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
|
2019-07-31 19:48:50 +00:00
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion)
|
2019-04-23 13:18:39 +00:00
|
|
|
|
|
|
|
install(TARGETS ${PROJECT_NAME}
|
2019-07-31 19:48:50 +00:00
|
|
|
EXPORT ${PROJECT_NAME}Config)
|
2019-04-23 13:18:39 +00:00
|
|
|
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
2019-07-31 19:48:50 +00:00
|
|
|
DESTINATION lib/cmake/${PROJECT_NAME})
|
2019-04-23 13:18:39 +00:00
|
|
|
|
2019-06-08 09:49:31 +00:00
|
|
|
install(EXPORT ${PROJECT_NAME}Config
|
2019-07-31 19:48:50 +00:00
|
|
|
NAMESPACE ${PROJECT_NAME}::
|
|
|
|
DESTINATION lib/cmake/${PROJECT_NAME})
|
2019-04-23 13:18:39 +00:00
|
|
|
|
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
|
2019-07-31 19:48:50 +00:00
|
|
|
DESTINATION .)
|