-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeMacros.cmake
51 lines (42 loc) · 1.93 KB
/
CMakeMacros.cmake
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
macro(append variable value)
set(${variable} "${${variable}} ${value}")
endmacro()
macro(replace variable str replacement)
string(REPLACE "${str}" "${replacement}" ${variable} ${${variable}})
endmacro()
macro(folder_source_group folderName)
file(GLOB ${folderName}Files ${folderName}/*.*)
source_group(${folderName} FILES ${${folderName}Files})
endmacro()
macro(folder_source_group_subfolder folderName subfolderName)
file(GLOB ${folderName}${subfolderName}Files ${folderName}/${subfolderName}/*.*)
source_group(${folderName}\\${subfolderName} FILES ${${folderName}${subfolderName}Files})
endmacro()
macro(folder_source_group_subsubfolder folderName subfolderName subsubFolderName)
file(GLOB ${folderName}${subfolderName}${subsubFolderName}Files ${folderName}/${subfolderName}/${subsubFolderName}/*.*)
source_group(${folderName}\\${subfolderName}\\${subsubFolderName} FILES ${${folderName}${subfolderName}${subsubFolderName}Files})
endmacro()
if(UNIX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
endif()
if(UNIX)
set(GoogleBenchmarkIncludeDirectory "/usr/local/include/GoogleBenchmark")
set(GoogleBenchmarkLibraryPath "/usr/local/lib/GoogleBenchmark/libbenchmark${CMAKE_BUILD_TYPE}.a")
elseif(MSVC)
set(GoogleBenchmarkIncludeDirectory "X:/include/GoogleBenchmark")
set(GoogleBenchmarkLibraryPath "X:/lib/GoogleBenchmark/benchmark$(Configuration).lib")
endif()
macro(IfMSVCEnablePrecompiledHeaders)
if(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/Yupch.h")
set_source_files_properties(pch.cpp PROPERTIES COMPILE_FLAGS "/Yc")
endif()
endmacro()
macro(IfMSVCAddPostBuildStepToRunTests)
if(MSVC)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND if not defined JENKINS_HOME $(TargetPath) --random --always-exit-0)
endif()
endmacro()
set(ZenUnitIncludeDirectory "${CMAKE_SOURCE_DIR}/ZenUnit")