-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·69 lines (55 loc) · 1.69 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 3.16)
project(sudoku
VERSION 0.9
DESCRIPTION "Sudoku Solver and Generator"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
if(UNIX)
set(CMAKE_CXX_FLAGS "-pthread")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g3 -ggdb -DDEBUG -pedantic -Wall -Wextra -Wconversion -Wreorder -Wuninitialized -Wtype-limits -Wno-pragmas")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -Wno-deprecated")
elseif(WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "/Od /Wall /Zi /wd5045 /wd4514 /wd4820 /D_CRT_SECURE_NO_WARNINGS /D__STDC_WANT_SECURE_LIB__")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /W1 /DNDEBUG /D_CRT_SECURE_NO_WARNINGS /D__STDC_WANT_SECURE_LIB__")
endif(UNIX)
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-security")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -glldb")
endif()
add_executable(sudoku
src/main.cpp
src/sudoku.cpp
src/util.cpp
)
if(UNIX)
set_target_properties(sudoku PROPERTIES LINK_FLAGS_RELEASE "-dead_strip")
endif(UNIX)
add_executable(sudoku2svg
src/sudoku2svg.cpp
src/util.cpp
)
if(UNIX)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET sudoku
POST_BUILD
COMMAND strip sudoku)
endif()
endif(UNIX)
if(UNIX)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET sudoku2svg
POST_BUILD
COMMAND strip sudoku2svg)
endif()
endif(UNIX)
target_include_directories(sudoku
PRIVATE ${PROJECT_INCLUDE_DIRS}
3rdparty/getopt-cpp/include
)
target_include_directories(sudoku2svg
PRIVATE ${PROJECT_INCLUDE_DIRS}
3rdparty/getopt-cpp/include
)
target_link_libraries(sudoku
)
install(TARGETS sudoku RUNTIME DESTINATION bin)