blob: 56fdf831d11e7d1a0d9be8ab90bdbf44220c1d4d (
plain)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
#-------------------------------------------------------------------------------
MACRO (SET_GLOBAL_VARIABLE name value)
set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
ENDMACRO (SET_GLOBAL_VARIABLE)
#-------------------------------------------------------------------------------
MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
#set(source_group_path "Source/AIM/${NAME}")
string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
#-- The following is needed if we ever start to use OS X Frameworks but only
#-- works on CMake 2.6 and greater
#set_property (SOURCE ${HEADERS}
# PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
#)
ENDMACRO (IDE_GENERATED_PROPERTIES)
#-------------------------------------------------------------------------------
MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
# install (FILES ${HEADERS}
# DESTINATION include/R3D/${NAME}
# COMPONENT Headers
# )
string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} )
source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
#-- The following is needed if we ever start to use OS X Frameworks but only
#-- works on CMake 2.6 and greater
#set_property (SOURCE ${HEADERS}
# PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
#)
ENDMACRO (IDE_SOURCE_PROPERTIES)
#-------------------------------------------------------------------------------
MACRO (TARGET_NAMING libtarget libtype)
if (WIN32)
if (${libtype} MATCHES "SHARED")
set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}dll")
endif (${libtype} MATCHES "SHARED")
endif (WIN32)
ENDMACRO (TARGET_NAMING)
#-------------------------------------------------------------------------------
MACRO (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
if (WIN32 AND MSVC)
get_target_property (target_name ${libtarget} RELWITHDEBINFO_OUTPUT_NAME)
install (
FILES
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${target_name}.pdb
DESTINATION
${targetdestination}
CONFIGURATIONS RelWithDebInfo
COMPONENT ${targetcomponent}
)
endif (WIN32 AND MSVC)
ENDMACRO (INSTALL_TARGET_PDB)
#-------------------------------------------------------------------------------
MACRO (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent)
if (WIN32 AND MSVC)
get_target_property (target_name ${progtarget} RELWITHDEBINFO_OUTPUT_NAME)
get_target_property (target_prefix ${progtarget} PREFIX)
install (
FILES
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${target_prefix}${target_name}.pdb
DESTINATION
${targetdestination}
CONFIGURATIONS RelWithDebInfo
COMPONENT ${targetcomponent}
)
endif (WIN32 AND MSVC)
ENDMACRO (INSTALL_PROGRAM_PDB)
#-------------------------------------------------------------------------------
MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
# message (STATUS "${libname} libtype: ${libtype}")
if (${libtype} MATCHES "SHARED")
if (WIN32)
set (LIB_RELEASE_NAME "${libname}")
set (LIB_DEBUG_NAME "${libname}_D")
else (WIN32)
set (LIB_RELEASE_NAME "${libname}")
set (LIB_DEBUG_NAME "${libname}_debug")
endif (WIN32)
else (${libtype} MATCHES "SHARED")
if (WIN32)
set (LIB_RELEASE_NAME "lib${libname}")
set (LIB_DEBUG_NAME "lib${libname}_D")
else (WIN32)
# if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value
if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
set (LIB_RELEASE_NAME "${libname}")
set (LIB_DEBUG_NAME "${libname}_debug")
else (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
set (LIB_RELEASE_NAME "lib${libname}")
set (LIB_DEBUG_NAME "lib${libname}_debug")
endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
endif (WIN32)
endif (${libtype} MATCHES "SHARED")
set_target_properties (${libtarget}
PROPERTIES
DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME}
RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME}
MINSIZEREL_OUTPUT_NAME ${LIB_RELEASE_NAME}
RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
)
#----- Use MSVC Naming conventions for Shared Libraries
if (MINGW AND ${libtype} MATCHES "SHARED")
set_target_properties (${libtarget}
PROPERTIES
IMPORT_SUFFIX ".lib"
IMPORT_PREFIX ""
PREFIX ""
)
endif (MINGW AND ${libtype} MATCHES "SHARED")
ENDMACRO (HDF_SET_LIB_OPTIONS)
#-------------------------------------------------------------------------------
MACRO (TARGET_C_PROPERTIES wintarget addcompileflags addlinkflags)
if (MSVC)
TARGET_MSVC_PROPERTIES (${wintarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
else (MSVC)
if (BUILD_SHARED_LIBS)
set_target_properties (${wintarget}
PROPERTIES
COMPILE_FLAGS "${addcompileflags}"
LINK_FLAGS "${addlinkflags}"
)
else (BUILD_SHARED_LIBS)
set_target_properties (${wintarget}
PROPERTIES
COMPILE_FLAGS "${addcompileflags}"
LINK_FLAGS "${addlinkflags}"
)
endif (BUILD_SHARED_LIBS)
endif (MSVC)
ENDMACRO (TARGET_C_PROPERTIES)
#-------------------------------------------------------------------------------
MACRO (TARGET_MSVC_PROPERTIES wintarget addcompileflags addlinkflags)
if (MSVC)
if (BUILD_SHARED_LIBS)
set_target_properties (${wintarget}
PROPERTIES
COMPILE_FLAGS "${addcompileflags}"
LINK_FLAGS "${addlinkflags}"
)
else (BUILD_SHARED_LIBS)
set_target_properties (${wintarget}
PROPERTIES
COMPILE_FLAGS "${addcompileflags}"
LINK_FLAGS "${addlinkflags}"
)
endif (BUILD_SHARED_LIBS)
endif (MSVC)
ENDMACRO (TARGET_MSVC_PROPERTIES)
#-------------------------------------------------------------------------------
MACRO (TARGET_FORTRAN_PROPERTIES forttarget addcompileflags addlinkflags)
if (WIN32)
TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
endif (WIN32)
ENDMACRO (TARGET_FORTRAN_PROPERTIES)
#-------------------------------------------------------------------------------
MACRO (TARGET_FORTRAN_WIN_PROPERTIES forttarget addcompileflags addlinkflags)
if (MSVC)
if (BUILD_SHARED_LIBS)
set_target_properties (${forttarget}
PROPERTIES
COMPILE_FLAGS "/dll ${addcompileflags}"
LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
)
else (BUILD_SHARED_LIBS)
set_target_properties (${forttarget}
PROPERTIES
COMPILE_FLAGS "${addcompileflags}"
LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
)
endif (BUILD_SHARED_LIBS)
endif (MSVC)
ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES)
|