CMake/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt

18 lines
602 B
CMake

set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden")
message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
endif()
if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden")
message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
endif()
add_library(visibility_preset SHARED visibility_preset.cpp)
generate_export_header(visibility_preset)
add_executable(visibility_preset_exe main.cpp)
target_link_libraries(visibility_preset_exe visibility_preset)