xcdat/CMakeLists.txt

47 lines
1.7 KiB
CMake
Raw Normal View History

2021-06-25 17:18:57 +00:00
cmake_minimum_required(VERSION 3.0)
2021-07-02 13:04:25 +00:00
project(xcdat VERSION 0.2.0 LANGUAGES CXX)
2016-12-03 07:51:00 +00:00
2017-11-12 11:49:13 +00:00
set(CMAKE_CXX_STANDARD 17)
2016-12-03 07:51:00 +00:00
2017-07-12 06:48:49 +00:00
if (NOT CMAKE_BUILD_TYPE)
2016-12-03 07:51:00 +00:00
set(CMAKE_BUILD_TYPE Release)
2017-07-12 06:48:49 +00:00
endif ()
2016-12-03 07:51:00 +00:00
2021-06-25 17:18:57 +00:00
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCXX 1)
endif ()
2017-07-12 06:48:49 +00:00
2021-06-25 17:18:57 +00:00
# C++17 compiler check
if ((CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.0) OR (CMAKE_COMPILER_IS_CLANGXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.0))
message(FATAL_ERROR "Your C++ compiler does not support C++17. Please install g++ 7.0 (or greater) or clang 4.0 (or greater)")
else ()
message(STATUS "Compiler is recent enough to support C++17.")
2017-07-12 06:48:49 +00:00
endif ()
2017-03-29 06:01:06 +00:00
2021-07-03 01:39:15 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pthread -Wall")
2021-06-25 17:18:57 +00:00
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -march=native -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer -O0 -g -DDEBUG")
2016-12-03 07:51:00 +00:00
message(STATUS "BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
2017-07-12 06:48:49 +00:00
message(STATUS "CXX_FLAGS are ${CMAKE_CXX_FLAGS}")
message(STATUS "CXX_FLAGS_DEBUG are ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CXX_FLAGS_RELEASE are ${CMAKE_CXX_FLAGS_RELEASE}")
2017-11-12 11:49:13 +00:00
include_directories(include)
2016-12-03 07:51:00 +00:00
2021-06-27 17:15:09 +00:00
add_subdirectory(sample)
add_subdirectory(tools)
2016-12-03 07:51:00 +00:00
enable_testing()
2021-06-27 17:15:09 +00:00
add_subdirectory(tests)
2021-06-26 14:48:29 +00:00
2021-06-27 17:15:09 +00:00
file(COPY ${CMAKE_SOURCE_DIR}/tests/keys.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tests)
2021-06-29 03:22:55 +00:00
# Install the library
file(GLOB XCDAT_HEADER_FILES include/xcdat/*.hpp)
install(FILES include/xcdat.hpp DESTINATION include)
install(FILES ${XCDAT_HEADER_FILES} DESTINATION include/xcdat)