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
gaoqiong
pybind11
Commits
faaee1cb
Commit
faaee1cb
authored
Nov 30, 2015
by
Wenzel Jakob
Browse files
only use -flto when supported, quenched policy warnings
parent
60c36db1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
CMakeLists.txt
CMakeLists.txt
+11
-2
No files found.
CMakeLists.txt
View file @
faaee1cb
...
...
@@ -27,14 +27,23 @@ set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package
(
PythonLibs
${
PYBIND11_PYTHON_VERSION
}
REQUIRED
)
find_package
(
PythonInterp
${
PYBIND11_PYTHON_VERSION
}
REQUIRED
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"GNU"
)
include
(
CheckCXXCompilerFlag
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
# Enable C++11 mode on C++ / Clang
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
# Enable link time optimization and set the default symbol
# visibility to hidden (very important to obtain small binaries)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden -flto"
)
# Default symbol visibility
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
# Check for Link Time Optimization support
CHECK_CXX_COMPILER_FLAG
(
"-flto"
HAS_LTO_FLAG
)
if
(
HAS_LTO_FLAG
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto"
)
endif
()
endif
()
endif
()
...
...
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