diff options
Diffstat (limited to 'Tests')
44 files changed, 659 insertions, 368 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9e74b7d..5ea604f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -285,24 +285,6 @@ if(BUILD_TESTING) PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)") endif() - if(CMAKE_TEST_GENERATOR MATCHES Make) - set(InterfaceBuildTargets_libname testlib) - if (CMAKE_TEST_GENERATOR MATCHES "Borland|Watcom") - set(InterfaceBuildTargets_libname testlib.lib) - endif() - add_test(InterfaceBuildTargets ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/InterfaceBuildTargets" - "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets" - --build-two-config - ${build_generator_args} - --build-project InterfaceBuildTargets - --build-options ${build_options} - --test-command ${CMAKE_CMAKE_COMMAND} -E touch_nocreate ${InterfaceBuildTargets_libname} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets") - endif() - list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) if(NOT QT4_FOUND) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index b5162c9..9bd7249 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -1,5 +1,13 @@ REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") +get_filename_component(CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR + "${CMAKE_CURRENT_BINARY_DIR}" REALPATH +) + +REGEX_ESCAPE_STRING(CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR + "${CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR}" +) + foreach (_retval 0 1) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) endforeach () @@ -180,7 +188,7 @@ set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") + PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") diff --git a/Tests/Contracts/VTK/Dashboard.cmake.in b/Tests/Contracts/VTK/Dashboard.cmake.in index e33a2de..c3d10f4 100644 --- a/Tests/Contracts/VTK/Dashboard.cmake.in +++ b/Tests/Contracts/VTK/Dashboard.cmake.in @@ -1,3 +1,11 @@ +# This submission's role is to test leading edge of cmake development +# against VTK release +# +# Maintainer: Zack Galbreath <zack.galbreath@kitware.com> +# +# This file was generated as part of the CMake/VTK Contracts test. +# See <CMake-src>/Tests/Contracts/VTK/ for more information + set(CTEST_SITE "@SITE@") set(CTEST_BUILD_NAME "Contracts.VTK") set(CTEST_DASHBOARD_ROOT "@base_dir@") @@ -6,6 +14,7 @@ set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/VTK-build") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_CONFIGURATION_TYPE Debug) +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") # Assume a Linux build, with a make that supports -j9. Modify this script if # assumption is ever invalid. diff --git a/Tests/InterfaceBuildTargets/CMakeLists.txt b/Tests/InterfaceBuildTargets/CMakeLists.txt deleted file mode 100644 index a00e5d5..0000000 --- a/Tests/InterfaceBuildTargets/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -project(InterfaceBuildTargets) - -add_library(testlib EXCLUDE_FROM_ALL testlib.cxx) -set_property(TARGET testlib PROPERTY PREFIX "") -if(CMAKE_GENERATOR MATCHES "Borland|Watcom") - # These librarians add the .lib suffix anyway. - set_property(TARGET testlib PROPERTY SUFFIX ".lib") -else() - set_property(TARGET testlib PROPERTY SUFFIX "") -endif() - -add_library(iface INTERFACE) -target_link_libraries(iface INTERFACE testlib) diff --git a/Tests/InterfaceBuildTargets/main.cxx b/Tests/InterfaceBuildTargets/main.cxx deleted file mode 100644 index e9ad257..0000000 --- a/Tests/InterfaceBuildTargets/main.cxx +++ /dev/null @@ -1,5 +0,0 @@ - -int main(int, char**) -{ - return 0; -} diff --git a/Tests/InterfaceBuildTargets/testlib.cxx b/Tests/InterfaceBuildTargets/testlib.cxx deleted file mode 100644 index 02bd6b0..0000000 --- a/Tests/InterfaceBuildTargets/testlib.cxx +++ /dev/null @@ -1,5 +0,0 @@ - -void testlib(void) -{ - -} diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 53aeb03..8154ced 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -13,3 +13,17 @@ add_subdirectory(libsdir) add_executable(sharedlibtestexe sharedlibtestexe.cpp) target_link_libraries(sharedlibtestexe shared_iface) + +add_library(broken EXCLUDE_FROM_ALL broken.cpp) + +add_library(iface_broken INTERFACE) +# This is not a dependency, so broken will not be built (and the error in +# it will not be hit) +target_link_libraries(iface_broken INTERFACE broken) + +add_library(iface_whitelist INTERFACE) +# The target property CUSTOM will never be evaluated on the INTERFACE library. +target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTOM>>:irrelevant>) + +add_executable(exec_whitelist dummy.cpp) +target_link_libraries(exec_whitelist iface_whitelist) diff --git a/Tests/InterfaceLibrary/broken.cpp b/Tests/InterfaceLibrary/broken.cpp new file mode 100644 index 0000000..1fd1041 --- /dev/null +++ b/Tests/InterfaceLibrary/broken.cpp @@ -0,0 +1,2 @@ + +#error Broken diff --git a/Tests/InterfaceLibrary/dummy.cpp b/Tests/InterfaceLibrary/dummy.cpp new file mode 100644 index 0000000..341aaaf --- /dev/null +++ b/Tests/InterfaceLibrary/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int, char **) +{ + return 0; +} diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 09f1881..bf867a9 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -55,93 +55,9 @@ else() endif() endif() -set(DEPS - libshared - libstatic - lib_shared_and_static -) - -foreach(DEP ${DEPS}) - try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/${DEP}_build - ${CMAKE_CURRENT_SOURCE_DIR}/${DEP} - ${DEP} - OUTPUT_VARIABLE Out - ) - if (NOT Result) - message("OUTPUT: ${Out}") - endif() -endforeach() - -# The _do_build macro is called from a child scope, where -# the current source and binary dir are different. Save them here -# for use in the macro. -set(TEST_TOP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(TEST_TOP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - - -# We seem to get race conditions is writing this stuff to the same file at least on MinGW -# So to write to separate source and build directories, we use a count to differentiate. -set (COUNT 0) -macro(_do_build Include Library LibrarySource Source) - - math(EXPR COUNT "${COUNT} + 1" ) - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/src.cpp" "#include \"${Include}\"\n" - "int main() { ${Source}; }\n" - ) - - if ("${Library}" STREQUAL "static_variant") - set(CONDITIONAL_STATIC_DEFINE "add_definitions(-DLIBSHARED_AND_STATIC_STATIC_DEFINE)\n") - endif() - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt" - "cmake_minimum_required(VERSION 2.8)\n" - - "project(compiletest)\n" - - "set(CMAKE_INCLUDE_CURRENT_DIR ON)\n" - - "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"\${CMAKE_CURRENT_BINARY_DIR}\")\n" - - "include(GenerateExportHeader)\n" - - "add_compiler_export_flags()\n" - - "if(NOT \"${ERROR_FLAG}\" STREQUAL \"\")\n" - " add_definitions(${ERROR_FLAG})\n" - "endif()\n" - - "include(\"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build/Targets.cmake\")\n" - - "include_directories(\"${TEST_TOP_SOURCE_DIR}/${LibrarySource}\"\n" - " \"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build\")\n" - - "${CONDITIONAL_STATIC_DEFINE}" - - "add_executable(compiletest src.cpp)\n" - "target_link_libraries(compiletest ${Library})\n" - ) - - try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/fail${COUNT} - ${CMAKE_CURRENT_BINARY_DIR}/test${COUNT} - compiletest - OUTPUT_VARIABLE Out - ) -endmacro() - -macro(build_fail Include Library LibrarySource Source Message) - _do_build(${Include} ${Library} ${LibrarySource} "${Source}") - test_fail(Result ${Message}) -endmacro() - -macro(build_pass Include Library LibrarySource Source Message) - _do_build(${Include} ${Library} ${LibrarySource} "${Source}") - test_pass(Result ${Message}) -endmacro() - include(GenerateExportHeader) -add_subdirectory(visibility_preset) +add_subdirectory(lib_shared_and_static) add_compiler_export_flags() @@ -159,23 +75,17 @@ macro(macro_add_test_library name) ${${name}_BINARY_DIR} # For the export header. ) list(APPEND link_libraries ${name}) - add_subdirectory(${name}test) endmacro() macro_add_test_library(libshared) macro_add_test_library(libstatic) -add_subdirectory(lib_shared_and_static) -add_subdirectory(lib_shared_and_statictest) -add_subdirectory(override_symbol) add_subdirectory(nodeprecated) -add_subdirectory(prefix) if(NOT BORLAND) add_subdirectory(c_identifier) endif() if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)) - # We deliberately call deprecated methods, and test for that elsewhere. # No need to clutter the test output with warnings. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") endif() @@ -187,3 +97,24 @@ endif() add_executable(GenerateExportHeader exportheader_test.cpp) target_link_libraries(GenerateExportHeader ${link_libraries}) +if (WIN32) + if(MSVC AND COMPILER_HAS_DEPRECATED) + set(_platform Win32) + elseif(MINGW 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/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 55c3c1a..146374a 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -11,6 +11,52 @@ #define DOES_NOT_BUILD(function) function #endif +#include <fstream> +#include <iostream> +#include <stdlib.h> +#include <string> + +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); + 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() { { @@ -78,5 +124,13 @@ int main() libstatic_not_exported(); libstatic_excluded(); +#define STRINGIFY_IMPL(A) #A +#define STRINGIFY(A) STRINGIFY_IMPL(A) + + compare(STRINGIFY(SRC_DIR) "/libshared_export.h", + STRINGIFY(BIN_DIR) "/libshared/libshared_export.h"); + compare(STRINGIFY(SRC_DIR) "/libstatic_export.h", + STRINGIFY(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 index be0387f..c1be125 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -5,7 +5,15 @@ project(lib_shared_and_static) include(GenerateExportHeader) -add_compiler_export_flags() +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) @@ -14,9 +22,13 @@ set(lib_SRCS ) add_library(shared_variant SHARED ${lib_SRCS}) +set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) add_library(static_variant ${lib_SRCS}) -generate_export_header(shared_variant BASE_NAME libshared_and_static) +generate_export_header(shared_variant + BASE_NAME libshared_and_static + PREFIX_NAME MYPREFIX_ +) set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) 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 index 049bfe9..5ad77f4 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -4,51 +4,51 @@ #include "libshared_and_static_export.h" -class LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { public: int libshared_and_static() const; int libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; class LibsharedAndStaticNotExported { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -class LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); +MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); -LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); +MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); int libshared_and_static_not_exported(); -int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); #endif diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt deleted file mode 100644 index 207534d..0000000 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ - -macro(shared_variant_build_pass Source Message) - build_pass("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(shared_variant_build_fail Source Message) - build_fail("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(static_variant_build_pass Source Message) - build_pass("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -macro(static_variant_build_fail Source Message) - build_fail("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message}) -endmacro() - -static_variant_build_pass("return libshared_and_static_exported();" "Failed to build static variant") -shared_variant_build_pass("return libshared_and_static_exported();" "Failed to build shared variant") -# if (COMPILER_HAS_DEPRECATED) -# shared_variant_build_fail("return libshared_and_static_deprecated();" "Built shared deprecated variant") -# static_variant_build_fail("return libshared_and_static_deprecated();" "Built static deprecated variant") -# else() -# shared_variant_build_pass("return libshared_and_static_deprecated();" "Built shared deprecated variant") -# static_variant_build_pass("return libshared_and_static_deprecated();" "Built static deprecated variant") -# endif() -static_variant_build_pass("return libshared_and_static_not_exported();" "Failed to build static not exported variant") - -if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY) - shared_variant_build_fail("return libshared_and_static_not_exported();" "Built shared not exported variant") -else() - shared_variant_build_pass("return libshared_and_static_not_exported();" "Built shared not exported variant") -endif() diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt deleted file mode 100644 index 2a97d8f..0000000 --- a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ - -macro(shared_build_pass Source Message) - build_pass("libshared.h" "libshared" "libshared" "${Source}" ${Message}) -endmacro() - -macro(shared_build_fail Source Message) - build_fail("libshared.h" "libshared" "libshared" "${Source}" ${Message}) -endmacro() - -shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported") -shared_build_pass("return libshared_exported();" "Failed to build exported function.") - -# if (COMPILER_HAS_DEPRECATED) -# shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") -# else() -# shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.") -# endif() -if (COMPILER_HAS_HIDDEN_VISIBILITY) - shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.") -else() - # There is no MSVC equivalent to hiding symbols. - shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.") -endif() - -if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY) - shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.") - shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.") - - shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.") - shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.") -else() - shared_build_pass("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method.") - shared_build_pass("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method.") - shared_build_pass("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method.") - shared_build_pass("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method.") - - shared_build_pass("return libshared_excluded();" "Built use of excluded function.") - shared_build_pass("return libshared_not_exported();" "Built use of not-exported function.") -endif() diff --git a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt deleted file mode 100644 index eb6bb87..0000000 --- a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - -macro(static_build_pass Source Message) - build_pass("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message}) -endmacro() - -macro(static_build_fail Source Message) - build_fail("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message}) -endmacro() - -static_build_pass("Libstatic l; return l.libstatic_exported();" "Failed to build exported.") - -# if (COMPILER_HAS_DEPRECATED) -# static_build_fail("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.") -# static_build_fail("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.") -# else() -# static_build_pass("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.") -# static_build_pass("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.") -# endif() diff --git a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt b/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt deleted file mode 100644 index aeeef20..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -project(override_symbol) - -add_library(somelib SHARED someclass.cpp) - -set_target_properties(somelib PROPERTIES DEFINE_SYMBOL SOMELIB_MAKEDLL) - -generate_export_header(somelib) - -add_executable(consumer main.cpp) - -target_link_libraries(consumer somelib) diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp deleted file mode 100644 index eec46d3..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/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/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp deleted file mode 100644 index 427ec29..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "someclass.h" - -void SomeClass::someMethod() const -{ - -} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h b/Tests/Module/GenerateExportHeader/override_symbol/someclass.h deleted file mode 100644 index ae5e844..0000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h +++ /dev/null @@ -1,8 +0,0 @@ - -#include "somelib_export.h" - -class SOMELIB_EXPORT SomeClass -{ -public: - void someMethod() const; -}; diff --git a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt b/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt deleted file mode 100644 index bd64df2..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -project(use_prefix) - -set(use_prefix_lib_SRCS - useprefixclass.cpp -) - -add_library(use_prefix_lib SHARED useprefixclass.cpp) - -generate_export_header(use_prefix_lib - PREFIX_NAME MYPREFIX_ -) - -add_executable(use_prefix main.cpp) - -target_link_libraries(use_prefix use_prefix_lib)
\ No newline at end of file diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp deleted file mode 100644 index 507f6fd..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "useprefixclass.h" - -int main(int argc, char **argv) -{ - UsePrefixClass upc; - return upc.someMethod(); -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp deleted file mode 100644 index 1fd2cb2..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "useprefixclass.h" - -int UsePrefixClass::someMethod() const -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h deleted file mode 100644 index f5e31b5..0000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef USEPREFIXCLASS_H -#define USEPREFIXCLASS_H - -#include "use_prefix_lib_export.h" - -class MYPREFIX_USE_PREFIX_LIB_EXPORT UsePrefixClass -{ -public: - int someMethod() const; -}; - -#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h new file mode 100644 index 0000000..b6749b2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h new file mode 100644 index 0000000..e8000e2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h new file mode 100644 index 0000000..d376631 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h new file mode 100644 index 0000000..7d8087f --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h new file mode 100644 index 0000000..5681f58 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h new file mode 100644 index 0000000..fd021e9 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h new file mode 100644 index 0000000..976c92e --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h new file mode 100644 index 0000000..db4df61 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h new file mode 100644 index 0000000..2dc41d4 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSHARED_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h new file mode 100644 index 0000000..e8000e2 --- /dev/null +++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -0,0 +1,41 @@ + +#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 + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define LIBSTATIC_NO_DEPRECATED +#endif + +#endif diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt deleted file mode 100644 index 2571d22..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() - -add_library(visibility_preset SHARED visibility_preset.cpp) -generate_export_header(visibility_preset) - -add_executable(visibility_preset_exe main.cpp) - -target_link_libraries(visibility_preset_exe visibility_preset) diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp deleted file mode 100644 index 89c3977..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "visibility_preset.h" - -int main() -{ - VisibilityPreset vp; - vp.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp deleted file mode 100644 index c97dec6..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "visibility_preset.h" - -void VisibilityPreset::someMethod() -{ - -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h deleted file mode 100644 index 8becbe1..0000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef VISIBILITY_PRESET_H -#define VISIBILITY_PRESET_H - -#include "visibility_preset_export.h" - -class VISIBILITY_PRESET_EXPORT VisibilityPreset -{ -public: - void someMethod(); -}; - -#endif diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index e257fb3..0d00b71 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(invalid_name) run_cmake(target_commands) run_cmake(no_shared_libs) run_cmake(whitelist) +run_cmake(genex_link) diff --git a/Tests/RunCMake/interface_library/genex_link-result.txt b/Tests/RunCMake/interface_library/genex_link-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/interface_library/genex_link-stderr.txt b/Tests/RunCMake/interface_library/genex_link-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/interface_library/genex_link.cmake b/Tests/RunCMake/interface_library/genex_link.cmake new file mode 100644 index 0000000..0dbf029 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 2.8.12.20131125 FATAL_ERROR) + +project(genex_link) + +set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp) +file(WRITE ${_main_cpp} + "int main(int argc, char** argv) { return 0; }\n" +) + +add_library(foo::bar INTERFACE IMPORTED) +set_target_properties(foo::bar + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" + # When not using a generator expression here, no error is generated + INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>" +) + +add_executable(main ${_main_cpp}) +target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(main foo::bar) |