Describe the issue
I am confused about the below cmake snippets in StandardSettings.cmake:
# Export all symbols when building a shared library
if(${PROJECT_NAME}_BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()
As cmake tool will build all the libraries as shared library when BUILD_SHARED_LIBS is ON, my understnading is that we should overwrite the cmake built-in cache variable of BUILD_SHARED_LIBS when ${PROJECT_NAME}_BUILD_SHARED_LIBS is ON. Something looks like this:
# Export all symbols when building a shared library
if(${PROJECT_NAME}_BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
set(BUILD_SHARED_LIBS ON CACHE BOOL "build shared libraries except when explicitely set to static" FORCE)
endif()
Let me know what you think it.
To Reproduce
None
Expected behavior
Overwrite the cmake built-in cache variable of BUILD_SHARED_LIBS when ${PROJECT_NAME}_BUILD_SHARED_LIBS is ON
Desktop (please complete the following information):
Describe the issue I am confused about the below cmake snippets in
StandardSettings.cmake
:As cmake tool will build all the libraries as shared library when
BUILD_SHARED_LIBS
is ON, my understnading is that we should overwrite the cmake built-in cache variable ofBUILD_SHARED_LIBS
when${PROJECT_NAME}_BUILD_SHARED_LIBS
is ON. Something looks like this:Let me know what you think it.
To Reproduce None
Expected behavior Overwrite the cmake built-in cache variable of
BUILD_SHARED_LIBS
when${PROJECT_NAME}_BUILD_SHARED_LIBS
is ONDesktop (please complete the following information):