-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
78 lines (54 loc) · 1.68 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
70
71
72
73
74
75
76
77
78
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
# variables declaration
SET(PROJECT core.tests)
SET(DEPENDS_ON_PROJECTS common core)
FILE(GLOB_RECURSE HEADERS "*.h")
FILE(GLOB_RECURSE SOURCES "*.cpp")
FILE(GLOB_RECURSE MOC_SOURCES "*_automoc.cpp")
SET(CONFIG_FILES "config.test.ini")
SET(TEXT_TEMPLATES "tests.h")
# check 64 bit
#if(CMAKE_SIZEOF_VOID_P EQUALS 4)
# set(HAVE_64_BIT 0)
#else()
# set(HAVE_64_BIT 1)
#endif()
if (MSVC)
# Now we support only x86 build with this. Be aware that x64 configuration will fail with a strange error 'Driver not found'
SET (DEPLOY_FILES ${DEPLOY_FILES} "C:/MySQL/MySQLConnectorC6.1/lib/libmysql.dll")
endif()
# source grouping
source_group ("Header Files" FILES ${HEADERS})
source_group ("Source Files" FILES ${SOURCES})
source_group ("Generated Files" FILES ${MOC_SOURCES})
# project definition
PROJECT(${PROJECT} CXX)
# includes
foreach(DEPENDENCY ${DEPENDS_ON_PROJECTS})
include_directories("../${DEPENDENCY}")
endforeach()
include_directories("..")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
# linking
add_executable(${PROJECT} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${CONFIG_FILES} ${TEXT_TEMPLATES})
SET_TARGET_PROPERTIES(${PROJECT} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(
${PROJECT}
${DEPENDS_ON_PROJECTS}
${Boost_LIBRARIES}
Qt5::Core
Qt5::Sql
Qt5::Network
debug ${GTEST_DEBUG_LIBS}
optimized ${GTEST_RELEASE_LIBS}
${Pthread})
# dependencies
add_dependencies(${PROJECT} googletest ${DEPENDS_ON_PROJECTS})
# add_custom_target(copy)
add_custom_action_copy(${CONFIG_FILES})
if (DEPLOY_FILES)
add_custom_action_copy(${DEPLOY_FILES})
endif()
if (MSVC)
add_custom_action_t4(${TEXT_TEMPLATES})
endif()