-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
38 lines (30 loc) · 966 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.1.3)
project(xformat CXX)
enable_testing()
include(CTest)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY tests)
set(CMAKE_CXX_STANDARD 14)
if(MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)
endif()
if(NOT MSVC)
add_definitions(-Wall -Wconversion -Wsign-compare)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
foreach(flagvar CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flagvar} "${${flagvar}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flagvar} "${${flagvar}}")
endforeach()
endif()
include_directories(include)
file(GLOB xformat_srcs src/*.cc src/*.cpp)
file(GLOB tests_srcs tests/*.cc)
add_library(xformat STATIC ${xformat_srcs})
if(BUILD_TESTING)
add_executable(run ${tests_srcs})
target_link_libraries(run xformat)
add_test(testall tests/run)
endif()