diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-18 12:12:18 +0200 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-02 12:00:51 +0200 |
commit | 0e9f4bc00c6b26f254e74063e4026ac33b786513 (patch) | |
tree | e12a3e2c39e38d11bdfef151289810bce99c16f3 /Tests/Module/GenerateExportHeader | |
parent | 5361270c6e9898b7ea10854ae101301772cd9b7d (diff) | |
download | cmake-0e9f4bc00c6b26f254e74063e4026ac33b786513.tar.gz |
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/GenerateExportHeader')
5 files changed, 44 insertions, 0 deletions
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 4a5b1cb5a3..359a1e3f54 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 0000000000..ffa938057f --- /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 0000000000..89c397784e --- /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 0000000000..c97dec6e29 --- /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 0000000000..8becbe1891 --- /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 |