-
Notifications
You must be signed in to change notification settings - Fork 0
/
PocoMacros.cmake
140 lines (122 loc) · 4.96 KB
/
PocoMacros.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
if(WIN32)
# cmake has CMAKE_RC_COMPILER, but no message compiler
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# this path is only present for 2008+, but we currently require PATH to
# be set up anyway
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH)
get_filename_component(kit10wow_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH)
file(GLOB kit10_list ${kit10_dir}/bin/10.* ${kit10wow_dir}/bin/10.*)
if(X64)
set(sdk_bindir "${sdk_dir}/bin/x64")
set(kit_bindir "${kit_dir}/bin/x64")
set(kit81_bindir "${kit81_dir}/bin/x64")
foreach(tmp_elem ${kit10_list})
if(IS_DIRECTORY ${tmp_elem})
list(APPEND kit10_bindir "${tmp_elem}/x64")
endif()
endforeach()
else(X64)
set(sdk_bindir "${sdk_dir}/bin")
set(kit_bindir "${kit_dir}/bin/x86")
set(kit81_bindir "${kit81_dir}/bin/x86")
foreach(tmp_elem ${kit10_list})
if(IS_DIRECTORY ${tmp_elem})
list(APPEND kit10_bindir "${tmp_elem}/x86")
endif()
endforeach()
endif(X64)
endif()
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir}
DOC "path to message compiler")
if(NOT CMAKE_MC_COMPILER)
message(FATAL_ERROR "message compiler not found: required to build")
endif(NOT CMAKE_MC_COMPILER)
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}")
mark_as_advanced(CMAKE_MC_COMPILER)
endif(WIN32)
##
macro(POCO_SOURCES_PLAT out name platform)
source_group("${name}\\Source Files" FILES ${ARGN})
list(APPEND ${out} ${ARGN})
if(NOT(${platform}))
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
endmacro()
macro(POCO_SOURCES out name)
POCO_SOURCES_PLAT( ${out} ${name} ON ${ARGN} )
endmacro()
macro(POCO_SOURCES_AUTO out)
POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN} )
endmacro()
macro(POCO_SOURCES_AUTO_PLAT out platform)
foreach(f ${ARGN})
get_filename_component(fname ${f} NAME)
file(STRINGS ${f} package REGEX "// Package: (.*)")
if(package)
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
if(${fname} MATCHES ".*_.*\\..*")
POCO_SOURCES_PLAT( ${out} ${name} OFF ${f} )
else()
POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f} )
endif()
else()
POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f} )
endif()
endforeach()
endmacro()
macro(POCO_HEADERS_AUTO out)
foreach(f ${ARGN})
get_filename_component(fname ${f} NAME)
file(STRINGS ${f} package REGEX "// Package: (.*)")
if(package)
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
POCO_HEADERS( ${out} ${name} ${f} )
else()
POCO_HEADERS( ${out} Unknown ${f} )
endif()
endforeach()
endmacro()
macro(POCO_HEADERS out name)
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
source_group("${name}\\Header Files" FILES ${ARGN})
list(APPEND ${out} ${ARGN})
endmacro()
macro(POCO_SOURCES_AUTO out)
POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN} )
endmacro()
macro(POCO_SOURCES_AUTO_PLAT out platform)
foreach(f ${ARGN})
get_filename_component(fname ${f} NAME)
file(STRINGS ${f} package REGEX "// Package: (.*)")
if(package)
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
if(${fname} MATCHES ".*_.*\\..*")
POCO_SOURCES_PLAT( ${out} ${name} OFF ${f} )
else()
POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f} )
endif()
else()
POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f} )
endif()
endforeach()
endmacro()
macro(POCO_HEADERS_AUTO out)
foreach(f ${ARGN})
get_filename_component(fname ${f} NAME)
file(STRINGS ${f} package REGEX "// Package: (.*)")
if(package)
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
POCO_HEADERS( ${out} ${name} ${f} )
else()
POCO_HEADERS( ${out} Unknown ${f} )
endif()
endforeach()
endmacro()
macro(POCO_HEADERS out name)
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
source_group("${name}\\Header Files" FILES ${ARGN})
list(APPEND ${out} ${ARGN})
endmacro()