nod/CMakeLists.txt

65 lines
1.7 KiB
CMake
Raw Normal View History

2015-09-02 11:53:24 -07:00
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2017-11-13 20:51:39 -08:00
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
2019-01-27 21:35:03 -08:00
project(nod VERSION 0.1)
2017-11-12 22:18:53 -08:00
set(CMAKE_CXX_STANDARD 17)
2017-06-17 19:52:39 -07:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2015-07-22 12:01:28 -07:00
endif()
2019-01-27 21:35:03 -08:00
include (CMakePackageConfigHelpers)
2017-07-08 22:25:19 -07:00
if (MSVC)
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1
/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 /wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 ${VS_DEFINES})
endif()
2016-03-04 15:04:30 -08:00
if (NOT TARGET logvisor)
add_subdirectory(logvisor)
set(LOGVISOR_INCLUDE_DIR logvisor/include)
2015-07-06 20:22:19 -07:00
endif()
2016-03-04 15:04:30 -08:00
include_directories(include ${LOGVISOR_INCLUDE_DIR})
file(GLOB NOD_HEADERS include/nod/*.h*)
2015-07-06 20:22:19 -07:00
add_subdirectory(lib)
add_subdirectory(driver)
2016-03-04 15:04:30 -08:00
install(DIRECTORY include/nod DESTINATION include/nod)
2019-01-27 21:35:03 -08:00
set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake")
set(config_file "${PROJECT_BINARY_DIR}/nodConfig.cmake")
set(config_install_dir "lib/cmake/nod")
# Associate target with export
install(
TARGETS nod
EXPORT nodTargets
ARCHIVE DESTINATION "lib"
INCLUDES DESTINATION "include/nod" # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target.
)
# Install the target config files
install(
EXPORT nodTargets
NAMESPACE "nod::"
DESTINATION "${config_install_dir}"
)
# Generate version config file
write_basic_package_version_file(
"${version_config_file}"
COMPATIBILITY SameMajorVersion
)
# Generate config file
configure_package_config_file(
"Config.cmake.in"
"${config_file}"
INSTALL_DESTINATION "lib/cmake/nod"
)
# Install the config files
install(
FILES "${config_file}" "${version_config_file}"
DESTINATION ${config_install_dir}
)