diff options
author | Brad King <brad.king@kitware.com> | 2018-01-24 13:52:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-24 13:53:05 (GMT) |
commit | 05e9cdb81ecddba496f21d0c9e35e9536261337f (patch) | |
tree | 8df6882afc2654302b6256eab19bec78e5caa84a /Tests | |
parent | 1a9da3c055d84479dc011ff66ecf887d92fadf23 (diff) | |
parent | b1ae9aaf790757d3fa43cccbb0e935171c191fff (diff) | |
download | CMake-05e9cdb81ecddba496f21d0c9e35e9536261337f.zip CMake-05e9cdb81ecddba496f21d0c9e35e9536261337f.tar.gz CMake-05e9cdb81ecddba496f21d0c9e35e9536261337f.tar.bz2 |
Merge topic 'GenerateExportHeader-include-guard'
b1ae9aaf GenerateExportHeader: add release notes, tests for include guard changes
f4082b0e GenerateExportHeader: add INCLUDE_GUARD_NAME option
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1643
Diffstat (limited to 'Tests')
19 files changed, 46 insertions, 14 deletions
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index cf81f36..ae9a84c 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -85,6 +85,7 @@ macro_add_test_library(libshared) macro_add_test_library(libstatic) add_subdirectory(nodeprecated) +add_subdirectory(includeguard) if(NOT BORLAND) add_subdirectory(c_identifier) endif() diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 55625a8..18c3340 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -12,6 +12,8 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + run_cmake_command(GEH-incguard-macro-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_macro) + run_cmake_command(GEH-incguard-custom-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_custom) file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" failure_test_targets) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt new file mode 100644 index 0000000..514d27b --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt @@ -0,0 +1,19 @@ +set(libincludeguard_SRC libincludeguard.cpp) + +add_library(includeguard_macro ${libincludeguard_SRC}) +generate_export_header(includeguard_macro) + +set(EXPORT_HEADER includeguard_macro_export.h) +set(DEF_SYMBOL INCLUDEGUARD_MACRO_EXPORT_H) +set(NDEF_SYMBOL CUSTOM_GUARD) +configure_file(main.cpp.in main_macro.cpp) +add_executable(test_includeguard_macro ${CMAKE_CURRENT_BINARY_DIR}/main_macro.cpp) + +add_library(includeguard_custom ${libincludeguard_SRC}) +generate_export_header(includeguard_custom INCLUDE_GUARD_NAME CUSTOM_GUARD) + +set(EXPORT_HEADER includeguard_custom_export.h) +set(DEF_SYMBOL CUSTOM_GUARD) +set(NDEF_SYMBOL INCLUDEGUARD_CUSTOM_EXPORT_H) +configure_file(main.cpp.in main_custom.cpp) +add_executable(test_includeguard_custom ${CMAKE_CURRENT_BINARY_DIR}/main_custom.cpp) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in new file mode 100644 index 0000000..51bd5d9 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in @@ -0,0 +1,10 @@ +#include "@EXPORT_HEADER@" + +int main() +{ +#if defined(@DEF_SYMBOL@) && !defined(@NDEF_SYMBOL@) + return 0; +#else + return 1; +#endif +} diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h index e8af0a5..0b1dcba 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h index 053ad18..11f8042 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h index 808ff01..1481acd 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h index 4e675af..3ba2d2e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h index 4d5ed4e..3c7e093 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h index 84340e3..bf9163e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ |