-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeMacros.cmake
More file actions
58 lines (49 loc) · 2.61 KB
/
CMakeMacros.cmake
File metadata and controls
58 lines (49 loc) · 2.61 KB
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
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()
macro(folder_source_group_subsubsubfolder folderName subfolderName subsubFolderName subsubsubFolderName)
file(GLOB ${folderName}${subfolderName}${subsubFolderName}${subsubsubFolderName}Files ${folderName}/${subfolderName}/${subsubFolderName}/${subsubsubFolderName}/*.*)
source_group(${folderName}\\${subfolderName}\\${subsubFolderName}\\${subsubsubFolderName} FILES ${${folderName}${subfolderName}${subsubFolderName}${subsubsubFolderName}Files})
endmacro()
macro(append variable value)
set(${variable} "${${variable}} ${value}")
endmacro()
macro(replace variable str replacement)
string(REPLACE "${str}" "${replacement}" ${variable} ${${variable}})
endmacro()
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(IfMSVCAddRunTestsPostBuildStep)
if(MSVC)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND if not defined JENKINS_HOME $(TargetPath) --always-exit-0)
endif()
endmacro()
if(UNIX)
set(ZenUnitAndMetalMockIncludeDirectory /usr/local/include/ZenUnitAndMetalMock)
elseif(MSVC)
set(ZenUnitAndMetalMockIncludeDirectory C:\\include\\ZenUnitAndMetalMock)
endif()
function(IfUNIXEnablePrecompiledHeaderAndPossiblyUnityBuildIfNotIncludeWhatYouUseOrClangTidyMode projectName unityBuildBatchSize)
if(UNIX)
if(NOT IncludeWhatYouUseMode AND NOT ClangTidyMode)
target_precompile_headers(${projectName} PRIVATE pch.h)
if(${unityBuildBatchSize} GREATER_EQUAL 2)
set_target_properties(${projectName} PROPERTIES UNITY_BUILD ON)
set_target_properties(${projectName} PROPERTIES UNITY_BUILD_BATCH_SIZE ${unityBuildBatchSize})
endif()
endif()
endif()
endfunction()