|
|
@ -93,7 +93,7 @@ function(pybind11_add_module target_name) |
|
|
|
# visibility to hidden (very important to obtain small binaries) |
|
|
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE) |
|
|
|
if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG) |
|
|
|
# Check for Link Time Optimization support (GCC/Clang) |
|
|
|
# # Check for Link Time Optimization support (GCC/Clang) |
|
|
|
check_cxx_compiler_flag("-flto" HAS_LTO_FLAG) |
|
|
|
if(HAS_LTO_FLAG AND NOT CYGWIN) |
|
|
|
target_compile_options(${target_name} PRIVATE -flto) |
|
|
@ -106,11 +106,13 @@ function(pybind11_add_module target_name) |
|
|
|
target_compile_options(${target_name} PRIVATE -ipo) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
# Default symbol visibility |
|
|
|
# |
|
|
|
if(NOT APPLE) |
|
|
|
# # Default symbol visibility |
|
|
|
target_compile_options(${target_name} PRIVATE "-fvisibility=hidden") |
|
|
|
endif() |
|
|
|
|
|
|
|
# Strip unnecessary sections of the binary on Linux/Mac OS |
|
|
|
# # Strip unnecessary sections of the binary on Linux/Mac OS |
|
|
|
if(CMAKE_STRIP) |
|
|
|
if(APPLE) |
|
|
|
add_custom_command(TARGET ${target_name} POST_BUILD |
|
|
|