diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-18 10:12:18 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-02 10:00:51 (GMT) |
commit | 0e9f4bc00c6b26f254e74063e4026ac33b786513 (patch) | |
tree | e12a3e2c39e38d11bdfef151289810bce99c16f3 /Tests/Module | |
parent | 5361270c6e9898b7ea10854ae101301772cd9b7d (diff) | |
download | CMake-0e9f4bc00c6b26f254e74063e4026ac33b786513.zip CMake-0e9f4bc00c6b26f254e74063e4026ac33b786513.tar.gz CMake-0e9f4bc00c6b26f254e74063e4026ac33b786513.tar.bz2 |
Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
Diffstat (limited to 'Tests/Module')
5 files changed, 44 insertions, 0 deletions
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 4a5b1cb..359a1e3 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -141,6 +141,8 @@ endmacro() include(GenerateExportHeader) +add_subdirectory(visibility_preset) + add_compiler_export_flags() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt new file mode 100644 index 0000000..ffa9380 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt @@ -0,0 +1,13 @@ + +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=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) diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp new file mode 100644 index 0000000..89c3977 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp @@ -0,0 +1,9 @@ + +#include "visibility_preset.h" + +int main() +{ + VisibilityPreset vp; + vp.someMethod(); + return 0; +} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp new file mode 100644 index 0000000..c97dec6 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp @@ -0,0 +1,7 @@ + +#include "visibility_preset.h" + +void VisibilityPreset::someMethod() +{ + +} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h new file mode 100644 index 0000000..8becbe1 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h @@ -0,0 +1,13 @@ + +#ifndef VISIBILITY_PRESET_H +#define VISIBILITY_PRESET_H + +#include "visibility_preset_export.h" + +class VISIBILITY_PRESET_EXPORT VisibilityPreset +{ +public: + void someMethod(); +}; + +#endif |