From fc3dab0ea956db618fe2b77778ac413db846b422 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 1 Sep 2016 15:22:05 -0400 Subject: Tests: Port GenerateExportHeader test to RunCMake infrastructure This will allow build failure cases to be added later. --- Tests/CMakeLists.txt | 1 - Tests/Module/GenerateExportHeader/CMakeLists.txt | 139 -------------------- .../c_identifier/CMakeLists.txt | 13 -- .../c_identifier/c_identifier_class.cpp | 7 -- .../c_identifier/c_identifier_class.h | 13 -- .../GenerateExportHeader/c_identifier/main.cpp | 8 -- .../GenerateExportHeader/exportheader_test.cpp | 137 -------------------- .../lib_shared_and_static/CMakeLists.txt | 38 ------ .../lib_shared_and_static/libshared_and_static.cpp | 106 ---------------- .../lib_shared_and_static/libshared_and_static.h | 66 ---------- .../GenerateExportHeader/libshared/CMakeLists.txt | 16 --- .../GenerateExportHeader/libshared/libshared.cpp | 102 --------------- .../GenerateExportHeader/libshared/libshared.h | 57 --------- .../GenerateExportHeader/libstatic/CMakeLists.txt | 18 --- .../GenerateExportHeader/libstatic/libstatic.cpp | 97 -------------- .../GenerateExportHeader/libstatic/libstatic.h | 57 --------- .../nodeprecated/CMakeLists.txt | 26 ---- .../nodeprecated/CMakeLists.txt.in | 15 --- .../GenerateExportHeader/nodeprecated/src/main.cpp | 9 -- .../nodeprecated/src/someclass.cpp | 8 -- .../nodeprecated/src/someclass.h | 10 -- .../reference/Empty/libshared_export.h | 42 ------- .../reference/Empty/libstatic_export.h | 42 ------- .../reference/MinGW/libshared_export.h | 42 ------- .../reference/MinGW/libstatic_export.h | 42 ------- .../reference/UNIX/libshared_export.h | 42 ------- .../reference/UNIX/libstatic_export.h | 42 ------- .../UNIX_DeprecatedOnly/libshared_export.h | 42 ------- .../UNIX_DeprecatedOnly/libstatic_export.h | 42 ------- .../reference/Win32-Clang/libshared_export.h | 42 ------- .../reference/Win32-Clang/libstatic_export.h | 42 ------- .../reference/Win32/libshared_export.h | 42 ------- .../reference/Win32/libstatic_export.h | 42 ------- .../reference/WinEmpty/libshared_export.h | 42 ------- .../reference/WinEmpty/libstatic_export.h | 42 ------- Tests/RunCMake/CMakeLists.txt | 3 + Tests/RunCMake/GenerateExportHeader/CMakeLists.txt | 3 + .../GenerateExportHeader/GEH-build-stderr.txt | 1 + Tests/RunCMake/GenerateExportHeader/GEH-stderr.txt | 1 + Tests/RunCMake/GenerateExportHeader/GEH.cmake | 140 +++++++++++++++++++++ .../GenerateExportHeader/RunCMakeTest.cmake | 17 +++ .../c_identifier/CMakeLists.txt | 13 ++ .../c_identifier/c_identifier_class.cpp | 7 ++ .../c_identifier/c_identifier_class.h | 13 ++ .../GenerateExportHeader/c_identifier/main.cpp | 8 ++ .../GenerateExportHeader/exportheader_test.cpp | 137 ++++++++++++++++++++ .../lib_shared_and_static/CMakeLists.txt | 38 ++++++ .../lib_shared_and_static/libshared_and_static.cpp | 106 ++++++++++++++++ .../lib_shared_and_static/libshared_and_static.h | 66 ++++++++++ .../GenerateExportHeader/libshared/CMakeLists.txt | 16 +++ .../GenerateExportHeader/libshared/libshared.cpp | 102 +++++++++++++++ .../GenerateExportHeader/libshared/libshared.h | 57 +++++++++ .../GenerateExportHeader/libstatic/CMakeLists.txt | 18 +++ .../GenerateExportHeader/libstatic/libstatic.cpp | 97 ++++++++++++++ .../GenerateExportHeader/libstatic/libstatic.h | 57 +++++++++ .../nodeprecated/CMakeLists.txt | 26 ++++ .../nodeprecated/CMakeLists.txt.in | 15 +++ .../GenerateExportHeader/nodeprecated/src/main.cpp | 9 ++ .../nodeprecated/src/someclass.cpp | 8 ++ .../nodeprecated/src/someclass.h | 10 ++ .../reference/Empty/libshared_export.h | 42 +++++++ .../reference/Empty/libstatic_export.h | 42 +++++++ .../reference/MinGW/libshared_export.h | 42 +++++++ .../reference/MinGW/libstatic_export.h | 42 +++++++ .../reference/UNIX/libshared_export.h | 42 +++++++ .../reference/UNIX/libstatic_export.h | 42 +++++++ .../UNIX_DeprecatedOnly/libshared_export.h | 42 +++++++ .../UNIX_DeprecatedOnly/libstatic_export.h | 42 +++++++ .../reference/Win32-Clang/libshared_export.h | 42 +++++++ .../reference/Win32-Clang/libstatic_export.h | 42 +++++++ .../reference/Win32/libshared_export.h | 42 +++++++ .../reference/Win32/libstatic_export.h | 42 +++++++ .../reference/WinEmpty/libshared_export.h | 42 +++++++ .../reference/WinEmpty/libstatic_export.h | 42 +++++++ Utilities/Scripts/clang-format.bash | 2 +- 75 files changed, 1557 insertions(+), 1532 deletions(-) delete mode 100644 Tests/Module/GenerateExportHeader/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp delete mode 100644 Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h delete mode 100644 Tests/Module/GenerateExportHeader/c_identifier/main.cpp delete mode 100644 Tests/Module/GenerateExportHeader/exportheader_test.cpp delete mode 100644 Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp delete mode 100644 Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h delete mode 100644 Tests/Module/GenerateExportHeader/libshared/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/libshared/libshared.cpp delete mode 100644 Tests/Module/GenerateExportHeader/libshared/libshared.h delete mode 100644 Tests/Module/GenerateExportHeader/libstatic/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp delete mode 100644 Tests/Module/GenerateExportHeader/libstatic/libstatic.h delete mode 100644 Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt.in delete mode 100644 Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp delete mode 100644 Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp delete mode 100644 Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h delete mode 100644 Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/GEH-build-stderr.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/GEH-stderr.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/GEH.cmake create mode 100644 Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/GenerateExportHeader/c_identifier/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.h create mode 100644 Tests/RunCMake/GenerateExportHeader/c_identifier/main.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h create mode 100644 Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/libshared/libshared.h create mode 100644 Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h create mode 100644 Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt create mode 100644 Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in create mode 100644 Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp create mode 100644 Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h create mode 100644 Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d6c96e1..8293286 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -485,7 +485,6 @@ if(BUILD_TESTING) ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") - ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader) ADD_TEST_MACRO(Module.FindDependency FindDependency) ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt deleted file mode 100644 index 56f0f28..0000000 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ -cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) -cmake_policy(SET CMP0054 NEW) - -project(GenerateExportHeader) - -# Prevent timeout on Watcom by not running the tests. -if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom) - file(WRITE - "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" - "int main() { return 0; } - " - ) - - add_executable( - GenerateExportHeader - "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" - ) - return() -endif() - -include(CheckCXXCompilerFlag) - -set( CMAKE_INCLUDE_CURRENT_DIR ON ) - -macro(TEST_FAIL value msg) - if (${value}) - message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} ) - endif () -endmacro() - -macro(TEST_PASS value msg) - if (NOT ${value}) - message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} ) - endif () -endmacro() - -check_cxx_compiler_flag(-Werror HAS_WERROR_FLAG) - -if(HAS_WERROR_FLAG) - set(ERROR_FLAG "-Werror") -else() - # MSVC - # And intel on windows? - # http://software.intel.com/en-us/articles/how-to-handle-warnings-message-in-compiler/?wapkw=%28compiler+warning+message%29 - check_cxx_compiler_flag("/WX" HAS_WX_FLAG) - if(HAS_WX_FLAG) - set(ERROR_FLAG "/WX") - else() - # Sun CC - # http://www.acsu.buffalo.edu/~charngda/sunstudio.html - check_cxx_compiler_flag("-errwarn=%all" HAS_ERRWARN_ALL) - if (HAS_ERRWARN_ALL) - set(ERROR_FLAG "-errwarn=%all") - else() - endif() - endif() -endif() - -include(GenerateExportHeader) - -set(CMAKE_CXX_STANDARD 98) - -# Those versions of the HP compiler that need a flag to get proper C++98 -# template support also need a flag to use the newer C++ library. -if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND - CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") - string(APPEND CMAKE_CXX_FLAGS " -AA") -endif () - -# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND - CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") - set(CMAKE_CXX_STANDARD 11) -endif() - -add_subdirectory(lib_shared_and_static) - -add_compiler_export_flags() - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -message("#### COMPILER_HAS_DEPRECATED: " ${COMPILER_HAS_DEPRECATED}) -message("#### COMPILER_HAS_HIDDEN_VISIBILITY: " ${COMPILER_HAS_HIDDEN_VISIBILITY}) -message("#### WIN32: " ${WIN32}) -message("#### HAS_WERROR_FLAG: " ${HAS_WERROR_FLAG}) - -set(link_libraries) -macro(macro_add_test_library name) - add_subdirectory(${name}) - include_directories(${name} - ${${name}_BINARY_DIR} # For the export header. - ) - list(APPEND link_libraries ${name}) -endmacro() - -macro_add_test_library(libshared) -macro_add_test_library(libstatic) - -add_subdirectory(nodeprecated) -if(NOT BORLAND) - add_subdirectory(c_identifier) -endif() - -if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)) - # No need to clutter the test output with warnings. - string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated-declarations") -endif() - -if(MSVC AND COMPILER_HAS_DEPRECATED) - add_definitions(/wd4996) -endif() - -add_executable(GenerateExportHeader exportheader_test.cpp) - -target_link_libraries(GenerateExportHeader ${link_libraries}) -if (WIN32 OR CYGWIN) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND - CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") - set(_platform Win32-Clang) - elseif(MSVC AND COMPILER_HAS_DEPRECATED) - set(_platform Win32) - elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED) - set(_platform MinGW) - else() - set(_platform WinEmpty) - endif() -elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) - set(_platform UNIX) -elseif(COMPILER_HAS_DEPRECATED) - set(_platform UNIX_DeprecatedOnly) -else() - set(_platform Empty) -endif() -message("#### Testing reference: ${_platform}") -target_compile_definitions(GenerateExportHeader - PRIVATE - "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" - "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" -) diff --git a/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt b/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt deleted file mode 100644 index 9f8c8ef..0000000 --- a/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -project(c_identifier) - -set(c_identifier_lib_SRCS - c_identifier_class.cpp -) - -add_library(7c-identifier-lib++ SHARED c_identifier_class.cpp) - -generate_export_header(7c-identifier-lib++) - -add_executable(c_identifier_exe main.cpp) - -target_link_libraries(c_identifier_exe 7c-identifier-lib++) diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp deleted file mode 100644 index d252c8e..0000000 --- a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "c_identifier_class.h" - -int CIdentifierClass::someMethod() const -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h deleted file mode 100644 index 741efdc..0000000 --- a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef C_IDENTIFIER_CLASS_H -#define C_IDENTIFIER_CLASS_H - -#include "7c-identifier-lib++_export.h" - -class _7C_IDENTIFIER_LIB___EXPORT CIdentifierClass -{ -public: - int someMethod() const; -}; - -#endif diff --git a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp deleted file mode 100644 index 891bc42..0000000 --- a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "c_identifier_class.h" - -int main(int argc, char** argv) -{ - CIdentifierClass cic; - return cic.someMethod(); -} diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp deleted file mode 100644 index 26bea7e..0000000 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ /dev/null @@ -1,137 +0,0 @@ - -#include "libshared.h" - -#include "libstatic.h" - -// #define BUILD_FAIL - -#ifndef BUILD_FAIL -#define DOES_NOT_BUILD(function) -#else -#define DOES_NOT_BUILD(function) function -#endif - -#include -#include -#include -#include - -void compare(const char* refName, const char* testName) -{ - std::ifstream ref; - ref.open(refName); - if (!ref.is_open()) { - std::cout << "Could not open \"" << refName << "\"." << std::endl; - exit(1); - } - std::ifstream test; - test.open(testName); - if (!test.is_open()) { - std::cout << "Could not open \"" << testName << "\"." << std::endl; - exit(1); - } - - while (!ref.eof() && !test.eof()) { - std::string refLine; - std::string testLine; - std::getline(ref, refLine); - std::getline(test, testLine); - // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a - // trailing null to the string that we need to strip before testing for a - // trailing space. - if (refLine.size() && refLine[refLine.size() - 1] == 0) { - refLine = refLine.substr(0, refLine.size() - 1); - } - if (testLine.size() && testLine[testLine.size() - 1] == 0) { - testLine = testLine.substr(0, testLine.size() - 1); - } - // The reference files never have trailing spaces: - if (testLine.size() && testLine[testLine.size() - 1] == ' ') { - testLine = testLine.substr(0, testLine.size() - 1); - } - if (refLine != testLine) { - std::cout << "Ref and test are not the same:\n Ref: \"" << refLine - << "\"\n Test: \"" << testLine << "\"\n"; - exit(1); - } - } - if (!ref.eof() || !test.eof()) { - std::cout << "Ref and test have differing numbers of lines."; - exit(1); - } -} - -int main() -{ - { - Libshared l; - l.libshared(); - l.libshared_exported(); - l.libshared_deprecated(); - l.libshared_not_exported(); - - DOES_NOT_BUILD(l.libshared_excluded();) - } - - { - LibsharedNotExported l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) - } - - { - LibsharedExcluded l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) - } - - libshared_exported(); - libshared_deprecated(); - DOES_NOT_BUILD(libshared_not_exported();) - DOES_NOT_BUILD(libshared_excluded();) - - { - Libstatic l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); - } - - { - LibstaticNotExported l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); - } - - { - LibstaticExcluded l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); - } - - libstatic_exported(); - libstatic_deprecated(); - libstatic_not_exported(); - libstatic_excluded(); - - compare(SRC_DIR "/libshared_export.h", - BIN_DIR "/libshared/libshared_export.h"); - compare(SRC_DIR "/libstatic_export.h", - BIN_DIR "/libstatic/libstatic_export.h"); - - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt deleted file mode 100644 index a057746..0000000 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ - -cmake_minimum_required(VERSION 2.8) - -project(lib_shared_and_static) - -include(GenerateExportHeader) - -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() - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(lib_SRCS - libshared_and_static.cpp -) - -add_library(shared_variant SHARED ${lib_SRCS}) -set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) -add_library(static_variant ${lib_SRCS}) - -set(MY_CUSTOM_CONTENT "#define MY_CUSTOM_CONTENT_ADDED") - -generate_export_header(shared_variant - BASE_NAME libshared_and_static - PREFIX_NAME MYPREFIX_ - CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT -) - -set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) - -export(TARGETS shared_variant static_variant FILE Targets.cmake) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp deleted file mode 100644 index 846c207..0000000 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ /dev/null @@ -1,106 +0,0 @@ - -#include "libshared_and_static.h" - -#ifndef MY_CUSTOM_CONTENT_ADDED -#error "MY_CUSTOM_CONTENT_ADDED not defined!" -#endif - -int LibsharedAndStatic::libshared_and_static() const -{ - return 0; -} - -int LibsharedAndStatic::libshared_and_static_exported() const -{ - return 0; -} - -int LibsharedAndStatic::libshared_and_static_deprecated() const -{ - return 0; -} - -int LibsharedAndStatic::libshared_and_static_not_exported() const -{ - return 0; -} - -int LibsharedAndStatic::libshared_and_static_excluded() const -{ - return 0; -} - -int LibsharedAndStaticNotExported::libshared_and_static() const -{ - return 0; -} - -int LibsharedAndStaticNotExported::libshared_and_static_exported() const -{ - return 0; -} - -int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const -{ - return 0; -} - -int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const -{ - return 0; -} - -int LibsharedAndStaticNotExported::libshared_and_static_excluded() const -{ - return 0; -} - -int LibsharedAndStaticExcluded::libshared_and_static() const -{ - return 0; -} - -int LibsharedAndStaticExcluded::libshared_and_static_exported() const -{ - return 0; -} - -int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const -{ - return 0; -} - -int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const -{ - return 0; -} - -int LibsharedAndStaticExcluded::libshared_and_static_excluded() const -{ - return 0; -} - -int libshared_and_static() -{ - return 0; -} - -int libshared_and_static_exported() -{ - return 0; -} - -int libshared_and_static_deprecated() -{ - return 0; -} - -int libshared_and_static_not_exported() -{ - return 0; -} - -int libshared_and_static_excluded() -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h deleted file mode 100644 index ea672fe..0000000 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ /dev/null @@ -1,66 +0,0 @@ - -#ifndef SHARED_AND_STATIC_H -#define SHARED_AND_STATIC_H - -#include "libshared_and_static_export.h" - -class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic -{ -public: - int libshared_and_static() const; - - int libshared_and_static_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; - - int libshared_and_static_not_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; -}; - -class LibsharedAndStaticNotExported -{ -public: - int libshared_and_static() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; - - int libshared_and_static_not_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; -}; - -class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded -{ -public: - int libshared_and_static() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; - - int libshared_and_static_not_exported() const; - - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; -}; - -MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); - -MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int -libshared_and_static_deprecated(); - -int libshared_and_static_not_exported(); - -int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); - -#endif diff --git a/Tests/Module/GenerateExportHeader/libshared/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libshared/CMakeLists.txt deleted file mode 100644 index e20adb1..0000000 --- a/Tests/Module/GenerateExportHeader/libshared/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ - -cmake_minimum_required(VERSION 2.8) - -project(libshared) - -include(GenerateExportHeader) - -add_compiler_export_flags() - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -add_library(libshared SHARED libshared.cpp) - -generate_export_header(libshared) - -export(TARGETS libshared FILE Targets.cmake) diff --git a/Tests/Module/GenerateExportHeader/libshared/libshared.cpp b/Tests/Module/GenerateExportHeader/libshared/libshared.cpp deleted file mode 100644 index ad6d356..0000000 --- a/Tests/Module/GenerateExportHeader/libshared/libshared.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -#include "libshared.h" - -int Libshared::libshared() const -{ - return 0; -} - -int Libshared::libshared_exported() const -{ - return 0; -} - -int Libshared::libshared_deprecated() const -{ - return 0; -} - -int Libshared::libshared_not_exported() const -{ - return 0; -} - -int Libshared::libshared_excluded() const -{ - return 0; -} - -int LibsharedNotExported::libshared() const -{ - return 0; -} - -int LibsharedNotExported::libshared_exported() const -{ - return 0; -} - -int LibsharedNotExported::libshared_deprecated() const -{ - return 0; -} - -int LibsharedNotExported::libshared_not_exported() const -{ - return 0; -} - -int LibsharedNotExported::libshared_excluded() const -{ - return 0; -} - -int LibsharedExcluded::libshared() const -{ - return 0; -} - -int LibsharedExcluded::libshared_exported() const -{ - return 0; -} - -int LibsharedExcluded::libshared_deprecated() const -{ - return 0; -} - -int LibsharedExcluded::libshared_not_exported() const -{ - return 0; -} - -int LibsharedExcluded::libshared_excluded() const -{ - return 0; -} - -int libshared() -{ - return 0; -} - -int libshared_exported() -{ - return 0; -} - -int libshared_deprecated() -{ - return 0; -} - -int libshared_not_exported() -{ - return 0; -} - -int libshared_excluded() -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/libshared/libshared.h b/Tests/Module/GenerateExportHeader/libshared/libshared.h deleted file mode 100644 index bd9f2e3..0000000 --- a/Tests/Module/GenerateExportHeader/libshared/libshared.h +++ /dev/null @@ -1,57 +0,0 @@ - -#ifndef LIBSHARED_H -#define LIBSHARED_H - -#include "libshared_export.h" - -class LIBSHARED_EXPORT Libshared -{ -public: - int libshared() const; - - int libshared_exported() const; - - int LIBSHARED_DEPRECATED libshared_deprecated() const; - - int libshared_not_exported() const; - - int LIBSHARED_NO_EXPORT libshared_excluded() const; -}; - -class LibsharedNotExported -{ -public: - int libshared() const; - - int LIBSHARED_EXPORT libshared_exported() const; - - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; - - int libshared_not_exported() const; - - int LIBSHARED_NO_EXPORT libshared_excluded() const; -}; - -class LIBSHARED_NO_EXPORT LibsharedExcluded -{ -public: - int libshared() const; - - int LIBSHARED_EXPORT libshared_exported() const; - - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; - - int libshared_not_exported() const; - - int LIBSHARED_NO_EXPORT libshared_excluded() const; -}; - -LIBSHARED_EXPORT int libshared_exported(); - -LIBSHARED_DEPRECATED_EXPORT int libshared_deprecated(); - -int libshared_not_exported(); - -int LIBSHARED_NO_EXPORT libshared_excluded(); - -#endif diff --git a/Tests/Module/GenerateExportHeader/libstatic/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libstatic/CMakeLists.txt deleted file mode 100644 index b2db3ea..0000000 --- a/Tests/Module/GenerateExportHeader/libstatic/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - -cmake_minimum_required(VERSION 2.8) - -project(libstatic) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -include(GenerateExportHeader) - -add_compiler_export_flags() - -# Show that the export header has no effect on a static library. - -add_library(libstatic STATIC libstatic.cpp) - -generate_export_header(libstatic) - -export(TARGETS libstatic FILE Targets.cmake) diff --git a/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp deleted file mode 100644 index 89381af..0000000 --- a/Tests/Module/GenerateExportHeader/libstatic/libstatic.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -#include "libstatic.h" - -int Libstatic::libstatic() const -{ - return 0; -} - -int Libstatic::libstatic_exported() const -{ - return 0; -} - -int Libstatic::libstatic_deprecated() const -{ - return 0; -} - -int Libstatic::libstatic_not_exported() const -{ - return 0; -} - -int Libstatic::libstatic_excluded() const -{ - return 0; -} - -int LibstaticNotExported::libstatic() const -{ - return 0; -} - -int LibstaticNotExported::libstatic_exported() const -{ - return 0; -} - -int LibstaticNotExported::libstatic_deprecated() const -{ - return 0; -} - -int LibstaticNotExported::libstatic_not_exported() const -{ - return 0; -} - -int LibstaticNotExported::libstatic_excluded() const -{ - return 0; -} - -int LibstaticExcluded::libstatic() const -{ - return 0; -} - -int LibstaticExcluded::libstatic_exported() const -{ - return 0; -} - -int LibstaticExcluded::libstatic_deprecated() const -{ - return 0; -} - -int LibstaticExcluded::libstatic_not_exported() const -{ - return 0; -} - -int LibstaticExcluded::libstatic_excluded() const -{ - return 0; -} - -int libstatic_exported() -{ - return 0; -} - -int libstatic_deprecated() -{ - return 0; -} - -int libstatic_not_exported() -{ - return 0; -} - -int libstatic_excluded() -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/libstatic/libstatic.h b/Tests/Module/GenerateExportHeader/libstatic/libstatic.h deleted file mode 100644 index 6072d9b..0000000 --- a/Tests/Module/GenerateExportHeader/libstatic/libstatic.h +++ /dev/null @@ -1,57 +0,0 @@ - -#ifndef LIBSTATIC_H -#define LIBSTATIC_H - -#include "libstatic_export.h" - -class LIBSTATIC_EXPORT Libstatic -{ -public: - int libstatic() const; - - int libstatic_exported() const; - - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; - - int libstatic_not_exported() const; - - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; -}; - -class LibstaticNotExported -{ -public: - int libstatic() const; - - int LIBSTATIC_EXPORT libstatic_exported() const; - - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; - - int libstatic_not_exported() const; - - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; -}; - -class LIBSTATIC_NO_EXPORT LibstaticExcluded -{ -public: - int libstatic() const; - - int LIBSTATIC_EXPORT libstatic_exported() const; - - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; - - int libstatic_not_exported() const; - - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; -}; - -LIBSTATIC_EXPORT int libstatic_exported(); - -LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated(); - -int libstatic_not_exported(); - -int LIBSTATIC_NO_EXPORT libstatic_excluded(); - -#endif diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt b/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt deleted file mode 100644 index aeeb13a..0000000 --- a/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -project(nodeprecated) - -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined) - -configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined/CMakeLists.txt) -set(DEFINE_NO_DEPRECATED DEFINE_NO_DEPRECATED) -configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined/CMakeLists.txt) - -try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined_build - ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined - nodeprecated_test - OUTPUT_VARIABLE Out -) - -test_pass(Result "Failed to build without no-deprecated define") - -try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined_build - ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined - nodeprecated_test - OUTPUT_VARIABLE Out -) - -test_fail(Result "Built even with no-deprecated define") \ No newline at end of file diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt.in b/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt.in deleted file mode 100644 index d8dc482..0000000 --- a/Tests/Module/GenerateExportHeader/nodeprecated/CMakeLists.txt.in +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -project(nodeprecated_test) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -include(GenerateExportHeader) - -add_library(nodeprecatedlib SHARED someclass.cpp) - -generate_export_header(nodeprecatedlib @DEFINE_NO_DEPRECATED@) - -add_executable(nodeprecatedconsumer main.cpp) - -target_link_libraries(nodeprecatedconsumer nodeprecatedlib) diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp deleted file mode 100644 index eec46d3..0000000 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "someclass.h" - -int main(int, char**) -{ - SomeClass sc; - sc.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp deleted file mode 100644 index 81dce62..0000000 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "someclass.h" - -#ifndef NODEPRECATEDLIB_NO_DEPRECATED -void SomeClass::someMethod() const -{ -} -#endif diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.h b/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.h deleted file mode 100644 index 312a177..0000000 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/someclass.h +++ /dev/null @@ -1,10 +0,0 @@ - -#include "nodeprecatedlib_export.h" - -class NODEPRECATEDLIB_EXPORT SomeClass -{ -public: -#ifndef NODEPRECATEDLIB_NO_DEPRECATED - void someMethod() const; -#endif -}; diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h deleted file mode 100644 index e8af0a5..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT -# else - /* We are using this library */ -# define LIBSHARED_EXPORT -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h deleted file mode 100644 index 598bd71..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h deleted file mode 100644 index cc20e09..0000000 --- a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define LIBSHARED_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h deleted file mode 100644 index 4aaa848..0000000 --- a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h deleted file mode 100644 index 053ad18..0000000 --- a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define LIBSHARED_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h deleted file mode 100644 index 4aaa848..0000000 --- a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h deleted file mode 100644 index 808ff01..0000000 --- a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT -# else - /* We are using this library */ -# define LIBSHARED_EXPORT -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h deleted file mode 100644 index 4aaa848..0000000 --- a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h deleted file mode 100644 index cc20e09..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define LIBSHARED_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h deleted file mode 100644 index 4aaa848..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h deleted file mode 100644 index 4e675af..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define LIBSHARED_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED __declspec(deprecated) -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h deleted file mode 100644 index 4d5ed4e..0000000 --- a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED __declspec(deprecated) -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h deleted file mode 100644 index 84340e3..0000000 --- a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSHARED_EXPORT_H -#define LIBSHARED_EXPORT_H - -#ifdef LIBSHARED_STATIC_DEFINE -# define LIBSHARED_EXPORT -# define LIBSHARED_NO_EXPORT -#else -# ifndef LIBSHARED_EXPORT -# ifdef libshared_EXPORTS - /* We are building this library */ -# define LIBSHARED_EXPORT __declspec(dllexport) -# else - /* We are using this library */ -# define LIBSHARED_EXPORT __declspec(dllimport) -# endif -# endif - -# ifndef LIBSHARED_NO_EXPORT -# define LIBSHARED_NO_EXPORT -# endif -#endif - -#ifndef LIBSHARED_DEPRECATED -# define LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_EXPORT -# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED -#endif - -#ifndef LIBSHARED_DEPRECATED_NO_EXPORT -# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSHARED_NO_DEPRECATED -# define LIBSHARED_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h deleted file mode 100644 index 598bd71..0000000 --- a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef LIBSTATIC_EXPORT_H -#define LIBSTATIC_EXPORT_H - -#ifdef LIBSTATIC_STATIC_DEFINE -# define LIBSTATIC_EXPORT -# define LIBSTATIC_NO_EXPORT -#else -# ifndef LIBSTATIC_EXPORT -# ifdef libstatic_EXPORTS - /* We are building this library */ -# define LIBSTATIC_EXPORT -# else - /* We are using this library */ -# define LIBSTATIC_EXPORT -# endif -# endif - -# ifndef LIBSTATIC_NO_EXPORT -# define LIBSTATIC_NO_EXPORT -# endif -#endif - -#ifndef LIBSTATIC_DEPRECATED -# define LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_EXPORT -# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED -#endif - -#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT -# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef LIBSTATIC_NO_DEPRECATED -# define LIBSTATIC_NO_DEPRECATED -# endif -#endif - -#endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 323a36b..fa3d0f9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -141,6 +141,9 @@ add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") + add_RunCMake_test(GenerateExportHeader) +endif() add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) diff --git a/Tests/RunCMake/GenerateExportHeader/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/CMakeLists.txt new file mode 100644 index 0000000..fb4d95e --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-build-stderr.txt b/Tests/RunCMake/GenerateExportHeader/GEH-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-stderr.txt b/Tests/RunCMake/GenerateExportHeader/GEH-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake new file mode 100644 index 0000000..e2a2a3b --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -0,0 +1,140 @@ +cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) +cmake_policy(SET CMP0054 NEW) + +project(GenerateExportHeader) + +# Prevent timeout on Watcom by not running the tests. +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom) + file(WRITE + "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" + "int main() { return 0; } + " + ) + + add_executable( + GenerateExportHeader + "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" + ) + return() +endif() + +include(CheckCXXCompilerFlag) + +set( CMAKE_INCLUDE_CURRENT_DIR ON ) + +macro(TEST_FAIL value msg) + if (${value}) + message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} ) + endif () +endmacro() + +macro(TEST_PASS value msg) + if (NOT ${value}) + message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} ) + endif () +endmacro() + +check_cxx_compiler_flag(-Werror HAS_WERROR_FLAG) + +if(HAS_WERROR_FLAG) + set(ERROR_FLAG "-Werror") +else() + # MSVC + # And intel on windows? + # http://software.intel.com/en-us/articles/how-to-handle-warnings-message-in-compiler/?wapkw=%28compiler+warning+message%29 + check_cxx_compiler_flag("/WX" HAS_WX_FLAG) + if(HAS_WX_FLAG) + set(ERROR_FLAG "/WX") + else() + # Sun CC + # http://www.acsu.buffalo.edu/~charngda/sunstudio.html + check_cxx_compiler_flag("-errwarn=%all" HAS_ERRWARN_ALL) + if (HAS_ERRWARN_ALL) + set(ERROR_FLAG "-errwarn=%all") + else() + endif() + endif() +endif() + +include(GenerateExportHeader) + +set(CMAKE_CXX_STANDARD 98) + +# Those versions of the HP compiler that need a flag to get proper C++98 +# template support also need a flag to use the newer C++ library. +if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND + CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") + string(APPEND CMAKE_CXX_FLAGS " -AA") +endif () + +# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(CMAKE_CXX_STANDARD 11) +endif() + +add_subdirectory(lib_shared_and_static) + +add_compiler_export_flags() + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}) + +message("#### COMPILER_HAS_DEPRECATED: " ${COMPILER_HAS_DEPRECATED}) +message("#### COMPILER_HAS_HIDDEN_VISIBILITY: " ${COMPILER_HAS_HIDDEN_VISIBILITY}) +message("#### WIN32: " ${WIN32}) +message("#### HAS_WERROR_FLAG: " ${HAS_WERROR_FLAG}) + +set(link_libraries) +macro(macro_add_test_library name) + add_subdirectory(${name}) + include_directories(${name} + ${${name}_BINARY_DIR} # For the export header. + ) + list(APPEND link_libraries ${name}) +endmacro() + +macro_add_test_library(libshared) +macro_add_test_library(libstatic) + +add_subdirectory(nodeprecated) +if(NOT BORLAND) + add_subdirectory(c_identifier) +endif() + +if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)) + # No need to clutter the test output with warnings. + string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated-declarations") +endif() + +if(MSVC AND COMPILER_HAS_DEPRECATED) + add_definitions(/wd4996) +endif() + +add_executable(GenerateExportHeader exportheader_test.cpp) + +target_link_libraries(GenerateExportHeader ${link_libraries}) +if (WIN32 OR CYGWIN) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND + CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + set(_platform Win32-Clang) + elseif(MSVC AND COMPILER_HAS_DEPRECATED) + set(_platform Win32) + elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED) + set(_platform MinGW) + else() + set(_platform WinEmpty) + endif() +elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) + set(_platform UNIX) +elseif(COMPILER_HAS_DEPRECATED) + set(_platform UNIX_DeprecatedOnly) +else() + set(_platform Empty) +endif() +message("#### Testing reference: ${_platform}") +target_compile_definitions(GenerateExportHeader + PRIVATE + "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" + "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" +) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake new file mode 100644 index 0000000..e534c1f --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_GEH) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GEH-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR MATCHES "Make|Ninja") + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(GEH) + run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) +endfunction() + +run_GEH() diff --git a/Tests/RunCMake/GenerateExportHeader/c_identifier/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/c_identifier/CMakeLists.txt new file mode 100644 index 0000000..9f8c8ef --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/c_identifier/CMakeLists.txt @@ -0,0 +1,13 @@ +project(c_identifier) + +set(c_identifier_lib_SRCS + c_identifier_class.cpp +) + +add_library(7c-identifier-lib++ SHARED c_identifier_class.cpp) + +generate_export_header(7c-identifier-lib++) + +add_executable(c_identifier_exe main.cpp) + +target_link_libraries(c_identifier_exe 7c-identifier-lib++) diff --git a/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.cpp b/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.cpp new file mode 100644 index 0000000..d252c8e --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.cpp @@ -0,0 +1,7 @@ + +#include "c_identifier_class.h" + +int CIdentifierClass::someMethod() const +{ + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.h b/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.h new file mode 100644 index 0000000..741efdc --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/c_identifier/c_identifier_class.h @@ -0,0 +1,13 @@ + +#ifndef C_IDENTIFIER_CLASS_H +#define C_IDENTIFIER_CLASS_H + +#include "7c-identifier-lib++_export.h" + +class _7C_IDENTIFIER_LIB___EXPORT CIdentifierClass +{ +public: + int someMethod() const; +}; + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/c_identifier/main.cpp b/Tests/RunCMake/GenerateExportHeader/c_identifier/main.cpp new file mode 100644 index 0000000..891bc42 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/c_identifier/main.cpp @@ -0,0 +1,8 @@ + +#include "c_identifier_class.h" + +int main(int argc, char** argv) +{ + CIdentifierClass cic; + return cic.someMethod(); +} diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp new file mode 100644 index 0000000..26bea7e --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -0,0 +1,137 @@ + +#include "libshared.h" + +#include "libstatic.h" + +// #define BUILD_FAIL + +#ifndef BUILD_FAIL +#define DOES_NOT_BUILD(function) +#else +#define DOES_NOT_BUILD(function) function +#endif + +#include +#include +#include +#include + +void compare(const char* refName, const char* testName) +{ + std::ifstream ref; + ref.open(refName); + if (!ref.is_open()) { + std::cout << "Could not open \"" << refName << "\"." << std::endl; + exit(1); + } + std::ifstream test; + test.open(testName); + if (!test.is_open()) { + std::cout << "Could not open \"" << testName << "\"." << std::endl; + exit(1); + } + + while (!ref.eof() && !test.eof()) { + std::string refLine; + std::string testLine; + std::getline(ref, refLine); + std::getline(test, testLine); + // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a + // trailing null to the string that we need to strip before testing for a + // trailing space. + if (refLine.size() && refLine[refLine.size() - 1] == 0) { + refLine = refLine.substr(0, refLine.size() - 1); + } + if (testLine.size() && testLine[testLine.size() - 1] == 0) { + testLine = testLine.substr(0, testLine.size() - 1); + } + // The reference files never have trailing spaces: + if (testLine.size() && testLine[testLine.size() - 1] == ' ') { + testLine = testLine.substr(0, testLine.size() - 1); + } + if (refLine != testLine) { + std::cout << "Ref and test are not the same:\n Ref: \"" << refLine + << "\"\n Test: \"" << testLine << "\"\n"; + exit(1); + } + } + if (!ref.eof() || !test.eof()) { + std::cout << "Ref and test have differing numbers of lines."; + exit(1); + } +} + +int main() +{ + { + Libshared l; + l.libshared(); + l.libshared_exported(); + l.libshared_deprecated(); + l.libshared_not_exported(); + + DOES_NOT_BUILD(l.libshared_excluded();) + } + + { + LibsharedNotExported l; + DOES_NOT_BUILD(l.libshared();) + l.libshared_exported(); + l.libshared_deprecated(); + DOES_NOT_BUILD(l.libshared_not_exported();) + DOES_NOT_BUILD(l.libshared_excluded();) + } + + { + LibsharedExcluded l; + DOES_NOT_BUILD(l.libshared();) + l.libshared_exported(); + l.libshared_deprecated(); + DOES_NOT_BUILD(l.libshared_not_exported();) + DOES_NOT_BUILD(l.libshared_excluded();) + } + + libshared_exported(); + libshared_deprecated(); + DOES_NOT_BUILD(libshared_not_exported();) + DOES_NOT_BUILD(libshared_excluded();) + + { + Libstatic l; + l.libstatic(); + l.libstatic_exported(); + l.libstatic_deprecated(); + l.libstatic_not_exported(); + l.libstatic_excluded(); + } + + { + LibstaticNotExported l; + l.libstatic(); + l.libstatic_exported(); + l.libstatic_deprecated(); + l.libstatic_not_exported(); + l.libstatic_excluded(); + } + + { + LibstaticExcluded l; + l.libstatic(); + l.libstatic_exported(); + l.libstatic_deprecated(); + l.libstatic_not_exported(); + l.libstatic_excluded(); + } + + libstatic_exported(); + libstatic_deprecated(); + libstatic_not_exported(); + libstatic_excluded(); + + compare(SRC_DIR "/libshared_export.h", + BIN_DIR "/libshared/libshared_export.h"); + compare(SRC_DIR "/libstatic_export.h", + BIN_DIR "/libstatic/libstatic_export.h"); + + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt new file mode 100644 index 0000000..a057746 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -0,0 +1,38 @@ + +cmake_minimum_required(VERSION 2.8) + +project(lib_shared_and_static) + +include(GenerateExportHeader) + +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() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(lib_SRCS + libshared_and_static.cpp +) + +add_library(shared_variant SHARED ${lib_SRCS}) +set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) +add_library(static_variant ${lib_SRCS}) + +set(MY_CUSTOM_CONTENT "#define MY_CUSTOM_CONTENT_ADDED") + +generate_export_header(shared_variant + BASE_NAME libshared_and_static + PREFIX_NAME MYPREFIX_ + CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT +) + +set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) + +export(TARGETS shared_variant static_variant FILE Targets.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp new file mode 100644 index 0000000..846c207 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -0,0 +1,106 @@ + +#include "libshared_and_static.h" + +#ifndef MY_CUSTOM_CONTENT_ADDED +#error "MY_CUSTOM_CONTENT_ADDED not defined!" +#endif + +int LibsharedAndStatic::libshared_and_static() const +{ + return 0; +} + +int LibsharedAndStatic::libshared_and_static_exported() const +{ + return 0; +} + +int LibsharedAndStatic::libshared_and_static_deprecated() const +{ + return 0; +} + +int LibsharedAndStatic::libshared_and_static_not_exported() const +{ + return 0; +} + +int LibsharedAndStatic::libshared_and_static_excluded() const +{ + return 0; +} + +int LibsharedAndStaticNotExported::libshared_and_static() const +{ + return 0; +} + +int LibsharedAndStaticNotExported::libshared_and_static_exported() const +{ + return 0; +} + +int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const +{ + return 0; +} + +int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const +{ + return 0; +} + +int LibsharedAndStaticNotExported::libshared_and_static_excluded() const +{ + return 0; +} + +int LibsharedAndStaticExcluded::libshared_and_static() const +{ + return 0; +} + +int LibsharedAndStaticExcluded::libshared_and_static_exported() const +{ + return 0; +} + +int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const +{ + return 0; +} + +int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const +{ + return 0; +} + +int LibsharedAndStaticExcluded::libshared_and_static_excluded() const +{ + return 0; +} + +int libshared_and_static() +{ + return 0; +} + +int libshared_and_static_exported() +{ + return 0; +} + +int libshared_and_static_deprecated() +{ + return 0; +} + +int libshared_and_static_not_exported() +{ + return 0; +} + +int libshared_and_static_excluded() +{ + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h new file mode 100644 index 0000000..ea672fe --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -0,0 +1,66 @@ + +#ifndef SHARED_AND_STATIC_H +#define SHARED_AND_STATIC_H + +#include "libshared_and_static_export.h" + +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic +{ +public: + int libshared_and_static() const; + + int libshared_and_static_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; + + int libshared_and_static_not_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; +}; + +class LibsharedAndStaticNotExported +{ +public: + int libshared_and_static() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT + libshared_and_static_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; + + int libshared_and_static_not_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; +}; + +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded +{ +public: + int libshared_and_static() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT + libshared_and_static_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED + libshared_and_static_deprecated() const; + + int libshared_and_static_not_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT + libshared_and_static_excluded() const; +}; + +MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); + +MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int +libshared_and_static_deprecated(); + +int libshared_and_static_not_exported(); + +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt new file mode 100644 index 0000000..e20adb1 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt @@ -0,0 +1,16 @@ + +cmake_minimum_required(VERSION 2.8) + +project(libshared) + +include(GenerateExportHeader) + +add_compiler_export_flags() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_library(libshared SHARED libshared.cpp) + +generate_export_header(libshared) + +export(TARGETS libshared FILE Targets.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp new file mode 100644 index 0000000..ad6d356 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp @@ -0,0 +1,102 @@ + +#include "libshared.h" + +int Libshared::libshared() const +{ + return 0; +} + +int Libshared::libshared_exported() const +{ + return 0; +} + +int Libshared::libshared_deprecated() const +{ + return 0; +} + +int Libshared::libshared_not_exported() const +{ + return 0; +} + +int Libshared::libshared_excluded() const +{ + return 0; +} + +int LibsharedNotExported::libshared() const +{ + return 0; +} + +int LibsharedNotExported::libshared_exported() const +{ + return 0; +} + +int LibsharedNotExported::libshared_deprecated() const +{ + return 0; +} + +int LibsharedNotExported::libshared_not_exported() const +{ + return 0; +} + +int LibsharedNotExported::libshared_excluded() const +{ + return 0; +} + +int LibsharedExcluded::libshared() const +{ + return 0; +} + +int LibsharedExcluded::libshared_exported() const +{ + return 0; +} + +int LibsharedExcluded::libshared_deprecated() const +{ + return 0; +} + +int LibsharedExcluded::libshared_not_exported() const +{ + return 0; +} + +int LibsharedExcluded::libshared_excluded() const +{ + return 0; +} + +int libshared() +{ + return 0; +} + +int libshared_exported() +{ + return 0; +} + +int libshared_deprecated() +{ + return 0; +} + +int libshared_not_exported() +{ + return 0; +} + +int libshared_excluded() +{ + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h new file mode 100644 index 0000000..bd9f2e3 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h @@ -0,0 +1,57 @@ + +#ifndef LIBSHARED_H +#define LIBSHARED_H + +#include "libshared_export.h" + +class LIBSHARED_EXPORT Libshared +{ +public: + int libshared() const; + + int libshared_exported() const; + + int LIBSHARED_DEPRECATED libshared_deprecated() const; + + int libshared_not_exported() const; + + int LIBSHARED_NO_EXPORT libshared_excluded() const; +}; + +class LibsharedNotExported +{ +public: + int libshared() const; + + int LIBSHARED_EXPORT libshared_exported() const; + + int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + + int libshared_not_exported() const; + + int LIBSHARED_NO_EXPORT libshared_excluded() const; +}; + +class LIBSHARED_NO_EXPORT LibsharedExcluded +{ +public: + int libshared() const; + + int LIBSHARED_EXPORT libshared_exported() const; + + int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + + int libshared_not_exported() const; + + int LIBSHARED_NO_EXPORT libshared_excluded() const; +}; + +LIBSHARED_EXPORT int libshared_exported(); + +LIBSHARED_DEPRECATED_EXPORT int libshared_deprecated(); + +int libshared_not_exported(); + +int LIBSHARED_NO_EXPORT libshared_excluded(); + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt new file mode 100644 index 0000000..b2db3ea --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt @@ -0,0 +1,18 @@ + +cmake_minimum_required(VERSION 2.8) + +project(libstatic) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +include(GenerateExportHeader) + +add_compiler_export_flags() + +# Show that the export header has no effect on a static library. + +add_library(libstatic STATIC libstatic.cpp) + +generate_export_header(libstatic) + +export(TARGETS libstatic FILE Targets.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp new file mode 100644 index 0000000..89381af --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp @@ -0,0 +1,97 @@ + +#include "libstatic.h" + +int Libstatic::libstatic() const +{ + return 0; +} + +int Libstatic::libstatic_exported() const +{ + return 0; +} + +int Libstatic::libstatic_deprecated() const +{ + return 0; +} + +int Libstatic::libstatic_not_exported() const +{ + return 0; +} + +int Libstatic::libstatic_excluded() const +{ + return 0; +} + +int LibstaticNotExported::libstatic() const +{ + return 0; +} + +int LibstaticNotExported::libstatic_exported() const +{ + return 0; +} + +int LibstaticNotExported::libstatic_deprecated() const +{ + return 0; +} + +int LibstaticNotExported::libstatic_not_exported() const +{ + return 0; +} + +int LibstaticNotExported::libstatic_excluded() const +{ + return 0; +} + +int LibstaticExcluded::libstatic() const +{ + return 0; +} + +int LibstaticExcluded::libstatic_exported() const +{ + return 0; +} + +int LibstaticExcluded::libstatic_deprecated() const +{ + return 0; +} + +int LibstaticExcluded::libstatic_not_exported() const +{ + return 0; +} + +int LibstaticExcluded::libstatic_excluded() const +{ + return 0; +} + +int libstatic_exported() +{ + return 0; +} + +int libstatic_deprecated() +{ + return 0; +} + +int libstatic_not_exported() +{ + return 0; +} + +int libstatic_excluded() +{ + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h new file mode 100644 index 0000000..6072d9b --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h @@ -0,0 +1,57 @@ + +#ifndef LIBSTATIC_H +#define LIBSTATIC_H + +#include "libstatic_export.h" + +class LIBSTATIC_EXPORT Libstatic +{ +public: + int libstatic() const; + + int libstatic_exported() const; + + int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + + int libstatic_not_exported() const; + + int LIBSTATIC_NO_EXPORT libstatic_excluded() const; +}; + +class LibstaticNotExported +{ +public: + int libstatic() const; + + int LIBSTATIC_EXPORT libstatic_exported() const; + + int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + + int libstatic_not_exported() const; + + int LIBSTATIC_NO_EXPORT libstatic_excluded() const; +}; + +class LIBSTATIC_NO_EXPORT LibstaticExcluded +{ +public: + int libstatic() const; + + int LIBSTATIC_EXPORT libstatic_exported() const; + + int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + + int libstatic_not_exported() const; + + int LIBSTATIC_NO_EXPORT libstatic_excluded() const; +}; + +LIBSTATIC_EXPORT int libstatic_exported(); + +LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated(); + +int libstatic_not_exported(); + +int LIBSTATIC_NO_EXPORT libstatic_excluded(); + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt new file mode 100644 index 0000000..aeeb13a --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 2.8) + +project(nodeprecated) + +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined) +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined) + +configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined/CMakeLists.txt) +set(DEFINE_NO_DEPRECATED DEFINE_NO_DEPRECATED) +configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined/CMakeLists.txt) + +try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined_build + ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined + nodeprecated_test + OUTPUT_VARIABLE Out +) + +test_pass(Result "Failed to build without no-deprecated define") + +try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined_build + ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined + nodeprecated_test + OUTPUT_VARIABLE Out +) + +test_fail(Result "Built even with no-deprecated define") \ No newline at end of file diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in new file mode 100644 index 0000000..d8dc482 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +project(nodeprecated_test) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +include(GenerateExportHeader) + +add_library(nodeprecatedlib SHARED someclass.cpp) + +generate_export_header(nodeprecatedlib @DEFINE_NO_DEPRECATED@) + +add_executable(nodeprecatedconsumer main.cpp) + +target_link_libraries(nodeprecatedconsumer nodeprecatedlib) diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp new file mode 100644 index 0000000..eec46d3 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp @@ -0,0 +1,9 @@ + +#include "someclass.h" + +int main(int, char**) +{ + SomeClass sc; + sc.someMethod(); + return 0; +} diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp new file mode 100644 index 0000000..81dce62 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp @@ -0,0 +1,8 @@ + +#include "someclass.h" + +#ifndef NODEPRECATEDLIB_NO_DEPRECATED +void SomeClass::someMethod() const +{ +} +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h new file mode 100644 index 0000000..312a177 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h @@ -0,0 +1,10 @@ + +#include "nodeprecatedlib_export.h" + +class NODEPRECATEDLIB_EXPORT SomeClass +{ +public: +#ifndef NODEPRECATEDLIB_NO_DEPRECATED + void someMethod() const; +#endif +}; diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h new file mode 100644 index 0000000..e8af0a5 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT +# else + /* We are using this library */ +# define LIBSHARED_EXPORT +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h new file mode 100644 index 0000000..598bd71 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h new file mode 100644 index 0000000..cc20e09 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h new file mode 100644 index 0000000..4aaa848 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h new file mode 100644 index 0000000..053ad18 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h new file mode 100644 index 0000000..4aaa848 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h new file mode 100644 index 0000000..808ff01 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT +# else + /* We are using this library */ +# define LIBSHARED_EXPORT +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h new file mode 100644 index 0000000..4aaa848 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h new file mode 100644 index 0000000..cc20e09 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h new file mode 100644 index 0000000..4aaa848 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h new file mode 100644 index 0000000..4e675af --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED __declspec(deprecated) +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h new file mode 100644 index 0000000..4d5ed4e --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED __declspec(deprecated) +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h new file mode 100644 index 0000000..84340e3 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSHARED_EXPORT_H +#define LIBSHARED_EXPORT_H + +#ifdef LIBSHARED_STATIC_DEFINE +# define LIBSHARED_EXPORT +# define LIBSHARED_NO_EXPORT +#else +# ifndef LIBSHARED_EXPORT +# ifdef libshared_EXPORTS + /* We are building this library */ +# define LIBSHARED_EXPORT __declspec(dllexport) +# else + /* We are using this library */ +# define LIBSHARED_EXPORT __declspec(dllimport) +# endif +# endif + +# ifndef LIBSHARED_NO_EXPORT +# define LIBSHARED_NO_EXPORT +# endif +#endif + +#ifndef LIBSHARED_DEPRECATED +# define LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_EXPORT +# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED +#endif + +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT +# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSHARED_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h new file mode 100644 index 0000000..598bd71 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -0,0 +1,42 @@ + +#ifndef LIBSTATIC_EXPORT_H +#define LIBSTATIC_EXPORT_H + +#ifdef LIBSTATIC_STATIC_DEFINE +# define LIBSTATIC_EXPORT +# define LIBSTATIC_NO_EXPORT +#else +# ifndef LIBSTATIC_EXPORT +# ifdef libstatic_EXPORTS + /* We are building this library */ +# define LIBSTATIC_EXPORT +# else + /* We are using this library */ +# define LIBSTATIC_EXPORT +# endif +# endif + +# ifndef LIBSTATIC_NO_EXPORT +# define LIBSTATIC_NO_EXPORT +# endif +#endif + +#ifndef LIBSTATIC_DEPRECATED +# define LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_EXPORT +# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED +#endif + +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT +# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef LIBSTATIC_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +# endif +#endif + +#endif diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash index a9ef62b..a7080fc 100755 --- a/Utilities/Scripts/clang-format.bash +++ b/Utilities/Scripts/clang-format.bash @@ -126,7 +126,7 @@ $git_ls -z -- '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '^Utilities/(KW|cm).*/' | # Exclude reference content. - egrep -z -v '^Tests/Module/GenerateExportHeader/reference/' | + egrep -z -v '^Tests/RunCMake/GenerateExportHeader/reference/' | # Exclude manually-formatted sources (e.g. with long lines). egrep -z -v '^Tests/PositionIndependentTargets/pic_test.h' | -- cgit v0.12