fix cmake

This commit is contained in:
terik23 2019-06-08 14:49:31 +05:00
parent 193f3c328e
commit 736082081e

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.8)
project(nameof VERSION "0.8.3" LANGUAGES CXX) project(nameof VERSION "0.8.3" LANGUAGES CXX)
@ -20,10 +20,11 @@ if(NAMEOF_OPT_BUILD_TESTS)
add_subdirectory(test) add_subdirectory(test)
endif() endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
add_library(${PROJECT_NAME} INTERFACE) 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} target_include_directories(${PROJECT_NAME}
INTERFACE INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@ -34,16 +35,14 @@ write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
COMPATIBILITY AnyNewerVersion) COMPATIBILITY AnyNewerVersion)
install(TARGETS ${PROJECT_NAME} install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets EXPORT ${PROJECT_NAME}Config)
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION lib/cmake/${PROJECT_NAME}) DESTINATION lib/cmake/${PROJECT_NAME})
install(EXPORT ${PROJECT_NAME}Targets install(EXPORT ${PROJECT_NAME}Config
NAMESPACE ${PROJECT_NAME}:: NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME}) DESTINATION lib/cmake/${PROJECT_NAME})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
DESTINATION include) DESTINATION .)