Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
71c79240
Commit
71c79240
authored
Sep 23, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the add_global_define() macro into its own file so it can be
easily used in multiple cmake files.
parent
b527635e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
CMakeLists.txt
dlib/CMakeLists.txt
+1
-19
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)
endif
()
endif
()
# 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
()
include
(
add_global_compiler_switch.cmake
)
# 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