2020-10-18 16:59:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2014-08-06 16:18:33 +00:00
|
|
|
project (crow_all)
|
2016-11-19 10:18:21 +00:00
|
|
|
|
2014-08-14 23:22:02 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
2016-10-03 11:47:22 +00:00
|
|
|
|
2014-08-14 23:22:02 +00:00
|
|
|
find_package(Tcmalloc)
|
2014-11-22 02:13:46 +00:00
|
|
|
find_package(Threads)
|
2016-09-06 00:40:55 +00:00
|
|
|
find_package(OpenSSL)
|
2016-10-03 11:47:22 +00:00
|
|
|
|
2016-09-06 00:40:55 +00:00
|
|
|
if(OPENSSL_FOUND)
|
2016-10-03 11:47:22 +00:00
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
2016-09-06 00:40:55 +00:00
|
|
|
endif()
|
2014-08-06 16:18:33 +00:00
|
|
|
|
2016-07-29 07:35:53 +00:00
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
message("Found ccache ${CCACHE_FOUND}")
|
|
|
|
message("Using ccache to speed up compilation")
|
|
|
|
set(ENV{CCACHE_CPP2} "yes")
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif(CCACHE_FOUND)
|
|
|
|
|
2014-08-06 23:31:27 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
2016-10-03 11:47:22 +00:00
|
|
|
message(STATUS "No build type selected, default to Release")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
2014-08-06 23:31:27 +00:00
|
|
|
endif()
|
|
|
|
|
2015-02-20 20:46:28 +00:00
|
|
|
if (MSVC)
|
2016-10-03 11:47:22 +00:00
|
|
|
set(Boost_USE_STATIC_LIBS "On")
|
|
|
|
find_package( Boost 1.52 COMPONENTS system thread regex REQUIRED )
|
2015-02-20 20:46:28 +00:00
|
|
|
else()
|
2020-10-31 18:22:34 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++14 -pedantic -Wextra")
|
2016-10-03 11:47:22 +00:00
|
|
|
find_package( Boost 1.52 COMPONENTS system thread REQUIRED )
|
2015-02-20 20:46:28 +00:00
|
|
|
endif()
|
|
|
|
|
2020-10-18 16:59:15 +00:00
|
|
|
include_directories(${Boost_INCLUDE_DIR})
|
2014-08-06 16:18:33 +00:00
|
|
|
|
2016-11-22 16:50:06 +00:00
|
|
|
set(PROJECT_INCLUDE_DIR
|
2020-10-18 16:59:15 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include
|
2014-08-06 16:18:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories("${PROJECT_INCLUDE_DIR}")
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}")
|
2016-11-22 16:50:06 +00:00
|
|
|
|
2014-08-06 16:18:33 +00:00
|
|
|
add_subdirectory(examples)
|
2016-10-03 11:47:22 +00:00
|
|
|
|
2015-02-20 20:46:28 +00:00
|
|
|
if (MSVC)
|
|
|
|
else()
|
2016-10-03 11:47:22 +00:00
|
|
|
add_subdirectory(tests)
|
2014-08-06 19:46:28 +00:00
|
|
|
|
2016-10-03 11:47:22 +00:00
|
|
|
enable_testing()
|
|
|
|
add_test(NAME crow_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest)
|
|
|
|
add_test(NAME template_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/template/test.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/template)
|
2014-08-07 16:14:27 +00:00
|
|
|
|
|
|
|
|
2020-10-31 18:22:34 +00:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/crow_all.h
|
|
|
|
COMMAND python ${PROJECT_SOURCE_DIR}/scripts/merge_all.py
|
2020-07-10 20:47:51 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include
|
2020-10-31 18:22:34 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/crow_all.h
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2017-09-17 20:15:41 +00:00
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/include/*.h ${PROJECT_SOURCE_DIR}/include/crow/*.h
|
2020-10-18 16:59:15 +00:00
|
|
|
)
|
2014-08-07 16:14:27 +00:00
|
|
|
|
2020-10-31 18:22:34 +00:00
|
|
|
add_custom_target(amalgamation ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/crow_all.h)
|
2015-02-20 20:46:28 +00:00
|
|
|
endif()
|