Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
71c79240
Commit
71c79240
authored
Sep 22, 2015
by
Davis King
Browse files
Moved the add_global_define() macro into its own file so it can be
easily used in multiple cmake files.
parent
b527635e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
dlib/CMakeLists.txt
dlib/CMakeLists.txt
+1
-19
dlib/add_global_compiler_switch.cmake
dlib/add_global_compiler_switch.cmake
+28
-0
No files found.
dlib/CMakeLists.txt
View file @
71c79240
...
@@ -27,25 +27,7 @@ if(COMMAND cmake_policy)
...
@@ -27,25 +27,7 @@ if(COMMAND cmake_policy)
endif
()
endif
()
endif
()
endif
()
include
(
add_global_compiler_switch.cmake
)
# make macros that can add #define directives to the entire project. Not just
# to the dlib library itself. I.e. to dlib and to any projects that depend
# on dlib.
macro
(
add_global_define def_name
)
if
(
NOT CMAKE_CXX_FLAGS MATCHES
"-D
${
def_name
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D
${
def_name
}
"
CACHE STRING
"Flags used by the compiler during all C++ builds."
FORCE
)
endif
()
endmacro
()
macro
(
remove_global_define def_name
)
if
(
CMAKE_CXX_FLAGS MATCHES
" -D
${
def_name
}
"
)
string
(
REGEX REPLACE
" -D
${
def_name
}
"
""
temp_var
${
CMAKE_CXX_FLAGS
}
)
set
(
CMAKE_CXX_FLAGS
"
${
temp_var
}
"
CACHE STRING
"Flags used by the compiler during all C++ builds."
FORCE
)
endif
()
endmacro
()
# Make sure ENABLE_ASSERTS is defined for debug builds
# Make sure ENABLE_ASSERTS is defined for debug builds
...
...
dlib/add_global_compiler_switch.cmake
0 → 100644
View file @
71c79240
# Make macros that can add compiler switches to the entire project. Not just
# to the current cmake folder being built.
macro
(
add_global_compiler_switch switch_name
)
if
(
NOT CMAKE_CXX_FLAGS MATCHES
"
${
switch_name
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
switch_name
}
"
CACHE STRING
"Flags used by the compiler during all C++ builds."
FORCE
)
endif
()
endmacro
()
macro
(
remove_global_compiler_switch switch_name
)
if
(
CMAKE_CXX_FLAGS MATCHES
"
${
switch_name
}
"
)
string
(
REGEX REPLACE
"
${
switch_name
}
"
""
temp_var
${
CMAKE_CXX_FLAGS
}
)
set
(
CMAKE_CXX_FLAGS
"
${
temp_var
}
"
CACHE STRING
"Flags used by the compiler during all C++ builds."
FORCE
)
endif
()
endmacro
()
macro
(
add_global_define def_name
)
add_global_compiler_switch
(
-D
${
def_name
}
)
endmacro
()
macro
(
remove_global_define def_name
)
remove_global_compiler_switch
(
-D
${
def_name
}
)
endmacro
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment