summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_link_libraries/empty.cpp4
-rw-r--r--Tests/CMakeLists.txt5
-rw-r--r--Tests/ExportImport/Export/testLibNoSONAME.c2
-rw-r--r--Tests/FindGTest/Test/CMakeLists.txt3
-rw-r--r--Tests/FindProtobuf/CMakeLists.txt10
-rw-r--r--Tests/FindProtobuf/Test/CMakeLists.txt32
-rw-r--r--Tests/FindProtobuf/Test/main-protoc.cxx8
-rw-r--r--Tests/FindProtobuf/Test/main.cxx8
-rw-r--r--Tests/FindTIFF/Test/CMakeLists.txt3
-rw-r--r--Tests/FindXalanC/Test/CMakeLists.txt3
-rw-r--r--Tests/FindXercesC/Test/CMakeLists.txt3
-rw-r--r--Tests/GoogleTest/CMakeLists.txt10
-rw-r--r--Tests/GoogleTest/Test/CMakeLists.txt82
-rw-r--r--Tests/GoogleTest/Test/main1.cxx30
-rw-r--r--Tests/GoogleTest/Test/main2.cxx1
-rw-r--r--Tests/GoogleTest/Test/main2.h6
-rw-r--r--Tests/GoogleTest/Test/main3.cxx11
-rw-r--r--Tests/GoogleTest/Test/main4.cxx1
-rw-r--r--Tests/GoogleTest/Test/main4.h6
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake2
-rw-r--r--Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CPack/STGZ/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake6
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake5
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake26
-rw-r--r--Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake14
-rw-r--r--Tests/SourceGroups/CMakeLists.txt9
-rw-r--r--Tests/SourceGroups/main.c9
-rw-r--r--Tests/SourceGroups/tree_foo.c4
-rw-r--r--Tests/SourceGroups/tree_prefix_bar.c4
-rw-r--r--Tests/SourceGroups/tree_prefix_foo.c4
-rw-r--r--Tests/Wrapping/fakefluid.cxx4
37 files changed, 312 insertions, 33 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/empty.cpp b/Tests/CMakeCommands/target_link_libraries/empty.cpp
index ab32cf6..a6ecef8 100644
--- a/Tests/CMakeCommands/target_link_libraries/empty.cpp
+++ b/Tests/CMakeCommands/target_link_libraries/empty.cpp
@@ -1 +1,3 @@
-// No content
+// Solaris needs non-empty content so ensure
+// we have at least one symbol
+int Solaris_requires_a_symbol_here = 0;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2f53cfc9..4b335bd 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1391,6 +1391,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
+ add_subdirectory(GoogleTest)
endif()
if(CMake_TEST_FindICU)
@@ -1437,6 +1438,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindPNG)
endif()
+ if(CMake_TEST_FindProtobuf)
+ add_subdirectory(FindProtobuf)
+ endif()
+
if(CMake_TEST_FindTIFF)
add_subdirectory(FindTIFF)
endif()
diff --git a/Tests/ExportImport/Export/testLibNoSONAME.c b/Tests/ExportImport/Export/testLibNoSONAME.c
index 30acc83..4d98562 100644
--- a/Tests/ExportImport/Export/testLibNoSONAME.c
+++ b/Tests/ExportImport/Export/testLibNoSONAME.c
@@ -4,7 +4,7 @@
#define testLibNoSONAME_EXPORT
#endif
-testLibNoSONAME_EXPORT int testLibNoSONAME(void)
+testLibNoSONAME_EXPORT int testLibNoSoName(void)
{
return 0;
}
diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt
index 99368ac..b65b9d2 100644
--- a/Tests/FindGTest/Test/CMakeLists.txt
+++ b/Tests/FindGTest/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindGTest CXX)
include(CTest)
-# CMake does not actually provide FindGTest publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(GTest REQUIRED)
add_executable(test_gtest_tgt main.cxx)
diff --git a/Tests/FindProtobuf/CMakeLists.txt b/Tests/FindProtobuf/CMakeLists.txt
new file mode 100644
index 0000000..1cdb2ae
--- /dev/null
+++ b/Tests/FindProtobuf/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindProtobuf.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindProtobuf/Test"
+ "${CMake_BINARY_DIR}/Tests/FindProtobuf/Test"
+ ${build_generator_args}
+ --build-project TestFindProtobuf
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt
new file mode 100644
index 0000000..d7a5081
--- /dev/null
+++ b/Tests/FindProtobuf/Test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindProtobuf CXX)
+include(CTest)
+
+find_package(Protobuf REQUIRED)
+
+add_executable(test_tgt main.cxx)
+target_link_libraries(test_tgt Protobuf::protobuf)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.cxx)
+target_include_directories(test_var PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${Protobuf_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
+
+add_executable(test_tgt_lite main.cxx)
+target_link_libraries(test_tgt_lite Protobuf::protobuf-lite)
+add_test(NAME test_tgt_lite COMMAND test_tgt_lite)
+
+add_executable(test_var_lite main.cxx)
+target_include_directories(test_var_lite PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var_lite PRIVATE ${Protobuf_LITE_LIBRARIES})
+add_test(NAME test_var_lite COMMAND test_var_lite)
+
+add_executable(test_tgt_protoc main-protoc.cxx)
+target_link_libraries(test_tgt_protoc Protobuf::protoc)
+add_test(NAME test_tgt_protoc COMMAND test_tgt_protoc)
+
+add_executable(test_var_protoc main-protoc.cxx)
+target_include_directories(test_var_protoc PRIVATE ${Protobuf_INCLUDE_DIRS})
+target_link_libraries(test_var_protoc PRIVATE ${Protobuf_PROTOC_LIBRARIES})
+add_test(NAME test_var_protoc COMMAND test_var_protoc)
diff --git a/Tests/FindProtobuf/Test/main-protoc.cxx b/Tests/FindProtobuf/Test/main-protoc.cxx
new file mode 100644
index 0000000..64e5ada
--- /dev/null
+++ b/Tests/FindProtobuf/Test/main-protoc.cxx
@@ -0,0 +1,8 @@
+#include <google/protobuf/compiler/command_line_interface.h>
+
+int main()
+{
+ google::protobuf::compiler::CommandLineInterface();
+
+ return 0;
+}
diff --git a/Tests/FindProtobuf/Test/main.cxx b/Tests/FindProtobuf/Test/main.cxx
new file mode 100644
index 0000000..87d5c12
--- /dev/null
+++ b/Tests/FindProtobuf/Test/main.cxx
@@ -0,0 +1,8 @@
+#include <google/protobuf/stubs/common.h>
+
+int main()
+{
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ return 0;
+}
diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt
index 6985e3f..85453ed 100644
--- a/Tests/FindTIFF/Test/CMakeLists.txt
+++ b/Tests/FindTIFF/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindTIFF C)
include(CTest)
-# CMake does not actually provide FindTIFF publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(TIFF REQUIRED)
add_executable(test_tiff_tgt main.c)
diff --git a/Tests/FindXalanC/Test/CMakeLists.txt b/Tests/FindXalanC/Test/CMakeLists.txt
index b445e0e..a8c2a0a 100644
--- a/Tests/FindXalanC/Test/CMakeLists.txt
+++ b/Tests/FindXalanC/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindXalanC CXX)
include(CTest)
-# CMake does not actually provide FindXalanC publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(XalanC REQUIRED)
add_executable(test_xalanc_tgt main.cxx)
diff --git a/Tests/FindXercesC/Test/CMakeLists.txt b/Tests/FindXercesC/Test/CMakeLists.txt
index 8e7767c..267c6a9 100644
--- a/Tests/FindXercesC/Test/CMakeLists.txt
+++ b/Tests/FindXercesC/Test/CMakeLists.txt
@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(TestFindXercesC CXX)
include(CTest)
-# CMake does not actually provide FindXercesC publicly.
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
-
find_package(XercesC REQUIRED)
add_executable(test_xercesc_tgt main.cxx)
diff --git a/Tests/GoogleTest/CMakeLists.txt b/Tests/GoogleTest/CMakeLists.txt
new file mode 100644
index 0000000..21f8b8b
--- /dev/null
+++ b/Tests/GoogleTest/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME GoogleTest.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/GoogleTest/Test"
+ "${CMake_BINARY_DIR}/Tests/GoogleTest/Test"
+ ${build_generator_args}
+ --build-project TestGoogleTest
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt
new file mode 100644
index 0000000..a1f08d4
--- /dev/null
+++ b/Tests/GoogleTest/Test/CMakeLists.txt
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 3.8)
+project(TestGoogleTest)
+include(CTest)
+
+include(GoogleTest)
+
+find_package(GTest REQUIRED)
+
+add_executable(test_gtest1 main1.cxx)
+target_link_libraries(test_gtest1 GTest::GTest)
+
+# Simple test of defaults
+gtest_add_tests(TARGET test_gtest1
+ TEST_LIST testList
+)
+set(expectedTests
+ GoogleTest.LinksAndRuns
+ GoogleTest.ConditionalFail
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+
+# Same target, different arguments, so use test prefix and suffix to
+# differentiate from the above test cases
+gtest_add_tests(TARGET test_gtest1
+ TEST_LIST testList
+ TEST_PREFIX "set2."
+ TEST_SUFFIX ".foo"
+ EXTRA_ARGS --forceFail
+)
+
+set(expectedTests
+ set2.GoogleTest.LinksAndRuns.foo
+ set2.GoogleTest.ConditionalFail.foo
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+set_tests_properties(set2.GoogleTest.ConditionalFail.foo PROPERTIES WILL_FAIL YES)
+
+
+# Search specific sources to get the test list
+add_executable(test_gtest2 main2.cxx)
+target_link_libraries(test_gtest2 GTest::Main)
+gtest_add_tests(TARGET test_gtest2
+ TEST_LIST testList
+ SOURCES main2.h
+)
+set(expectedTests
+ GoogleTest.SomethingElse
+)
+if(NOT testList STREQUAL "${expectedTests}")
+ message(FATAL_ERROR "Expected test list: ${expectedTests}
+Actual test list: ${testList}")
+endif()
+
+
+# Non-keyword form, auto-find sources
+add_executable(test_gtest3 main3.cxx)
+target_link_libraries(test_gtest3 GTest::Main)
+gtest_add_tests(test_gtest3 "" AUTO)
+if(NOT TEST GoogleTest.Foo)
+ message(FATAL_ERROR "Test case GoogleTest.Foo not defined")
+endif()
+if(NOT TEST GoogleTest.Bar)
+ message(FATAL_ERROR "Test case GoogleTest.Bar not defined")
+endif()
+
+
+# Non-keyword form, explicitly specified sources. Allows a non-target to be
+# given for the executable.
+add_executable(test_gtest4 main4.cxx)
+target_link_libraries(test_gtest4 GTest::Main)
+gtest_add_tests($<TARGET_FILE:test_gtest4> "" main4.h)
+if(NOT TEST GoogleTest.NoKeywords)
+ message(FATAL_ERROR "Test case GoogleTest.NoKeywords not defined")
+endif()
diff --git a/Tests/GoogleTest/Test/main1.cxx b/Tests/GoogleTest/Test/main1.cxx
new file mode 100644
index 0000000..03d604b
--- /dev/null
+++ b/Tests/GoogleTest/Test/main1.cxx
@@ -0,0 +1,30 @@
+#include <gtest/gtest.h>
+
+#include <string>
+
+namespace {
+bool shouldFail = false;
+}
+
+TEST(GoogleTest, LinksAndRuns)
+{
+ ASSERT_TRUE(true);
+}
+
+TEST(GoogleTest, ConditionalFail)
+{
+ ASSERT_FALSE(shouldFail);
+}
+
+int main(int argc, char* argv[])
+{
+ ::testing::InitGoogleTest(&argc, argv);
+
+ if (argc > 1) {
+ if (argv[1] != std::string("--forceFail")) {
+ throw "Unexpected argument";
+ }
+ shouldFail = true;
+ }
+ return RUN_ALL_TESTS();
+}
diff --git a/Tests/GoogleTest/Test/main2.cxx b/Tests/GoogleTest/Test/main2.cxx
new file mode 100644
index 0000000..05ffb4a
--- /dev/null
+++ b/Tests/GoogleTest/Test/main2.cxx
@@ -0,0 +1 @@
+#include "main2.h"
diff --git a/Tests/GoogleTest/Test/main2.h b/Tests/GoogleTest/Test/main2.h
new file mode 100644
index 0000000..7243f53
--- /dev/null
+++ b/Tests/GoogleTest/Test/main2.h
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, SomethingElse)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/GoogleTest/Test/main3.cxx b/Tests/GoogleTest/Test/main3.cxx
new file mode 100644
index 0000000..98ce13c
--- /dev/null
+++ b/Tests/GoogleTest/Test/main3.cxx
@@ -0,0 +1,11 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, Foo)
+{
+ ASSERT_TRUE(true);
+}
+
+TEST(GoogleTest, Bar)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/GoogleTest/Test/main4.cxx b/Tests/GoogleTest/Test/main4.cxx
new file mode 100644
index 0000000..8023bc1
--- /dev/null
+++ b/Tests/GoogleTest/Test/main4.cxx
@@ -0,0 +1 @@
+#include "main4.h"
diff --git a/Tests/GoogleTest/Test/main4.h b/Tests/GoogleTest/Test/main4.h
new file mode 100644
index 0000000..19da12a
--- /dev/null
+++ b/Tests/GoogleTest/Test/main4.h
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+TEST(GoogleTest, NoKeywords)
+{
+ ASSERT_TRUE(true);
+}
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
index f672285..5d39214 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll-stderr.txt
@@ -4,13 +4,13 @@ CMake Warning \(dev\) in CMakeLists.txt:
cmake_policy command to set the policy and suppress this warning.
Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
- its LINK_INTERFACE_LIBRARIES properties.
+ its LINK_INTERFACE_LIBRARIES(_DEBUG)? properties.
INTERFACE_LINK_LIBRARIES:
foo
- LINK_INTERFACE_LIBRARIES:
+ LINK_INTERFACE_LIBRARIES(_DEBUG)?:
bat
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
index 11b4e22..03223e8 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-tll.cmake
@@ -5,7 +5,9 @@ add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
target_link_libraries(bar LINK_PUBLIC foo)
+# Replace the compatibility values set by target_link_libraries
set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES bat)
+set_property(TARGET bar PROPERTY LINK_INTERFACE_LIBRARIES_DEBUG bat)
add_library(user SHARED empty.cpp)
target_link_libraries(user bar)
diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
index ce039f5..99d3155 100644
--- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
+++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake
@@ -33,7 +33,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
# component and monolithic packages differ for some reason by either having
# package filename prefix in path or not
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 8ca7126..faf151a 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -5,7 +5,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT")
-run_cpack_test(CUSTOM_NAMES "RPM;DEB" true "COMPONENT")
+run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT")
run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
run_cpack_test(DIST "RPM" false "MONOLITHIC")
@@ -24,5 +24,6 @@ run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_co
run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT")
run_cpack_source_test(SOURCE_PACKAGE "RPM")
run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC")
+run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT")
run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC")
run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
index 08224d3..68b1eab 100644
--- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake
+++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake
@@ -35,7 +35,7 @@ function(getPackageContentList FILE RESULT_VAR)
endfunction()
function(toExpectedContentList FILE_NO CONTENT_VAR)
- findExpectedFile("${FILE_NO}" "file_")
+ findExpectedFile("${FILE_NO}" "file_" "glob_expr_")
get_filename_component(prefix_ "${file_}" NAME)
# NAME_WE removes everything after the dot and dot is in version so replace instead
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 59751a7..470ebf7 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
-function(findExpectedFile FILE_NO RESULT_VAR)
+function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR)
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data
# set defaults if parameters are not provided
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME)
@@ -21,6 +21,7 @@ function(findExpectedFile FILE_NO RESULT_VAR)
file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}")
set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE)
+ set(${GLOBING_EXPR_VAR} "${EXPECTED_FILE_${FILE_NO}}" PARENT_SCOPE)
endfunction()
include("${config_file}")
@@ -39,7 +40,8 @@ include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake")
# check that expected generated files exist and contain expected content
if(NOT EXPECTED_FILES_COUNT EQUAL 0)
foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
- findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}")
+ findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}"
+ "EXPECTED_FILE_${file_no_}")
list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}")
list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_)
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
index ae5f0af..5cb280c 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
@@ -9,4 +9,7 @@ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
set(EXPECTED_FILE_3 "pkg_3_abc.${file_extension_}")
+elseif(GENERATOR_TYPE STREQUAL "TGZ")
+ set(EXPECTED_FILE_2 "second.tar.gz")
+ set(EXPECTED_FILE_3 "pkg_3_abc.tar.gz")
endif()
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
index 0c2b37b..4c20e41 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
@@ -7,6 +7,9 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second")
string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_3_FILE_NAME "pkg_3_abc.${file_extension_}")
+elseif(GENERATOR_TYPE STREQUAL "TGZ")
+ set(CPACK_ARCHIVE_PKG_2_FILE_NAME "second")
+ set(CPACK_ARCHIVE_PKG_3_FILE_NAME "pkg_3_abc")
endif()
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
new file mode 100644
index 0000000..05be748
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake
@@ -0,0 +1,13 @@
+set(EXPECTED_FILES_COUNT "1")
+
+set(EXPECTED_FILE_CONTENT_1_LIST
+ "/usr"
+ "/usr/empty_dir"
+ "/usr/non_empty_dir"
+ "/usr/non_empty_dir/CMakeLists.txt"
+ "/usr/symlink_to_empty_dir"
+ "/usr/symlink_to_non_empty_dir")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(EXPECTED_FILE_1_COMPONENT "links")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
new file mode 100644
index 0000000..f3df46b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/TGZ-Prerequirements.cmake
@@ -0,0 +1,5 @@
+function(get_test_prerequirements found_var config_file)
+ if(UNIX) # limit test to platforms that support symlinks
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
new file mode 100644
index 0000000..0632319
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/VerifyResult.cmake
@@ -0,0 +1,26 @@
+set(whitespaces "[\\t\\n\\r ]*")
+
+#######################
+# verify generated symbolic links
+#######################
+file(GLOB_RECURSE symlink_files RELATIVE "${bin_dir}" "${bin_dir}/*/symlink_*")
+
+foreach(check_symlink IN LISTS symlink_files)
+ get_filename_component(symlink_name "${check_symlink}" NAME)
+ execute_process(COMMAND ls -la "${check_symlink}"
+ WORKING_DIRECTORY "${bin_dir}"
+ OUTPUT_VARIABLE SYMLINK_POINT_
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if("${symlink_name}" STREQUAL "symlink_to_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ elseif("${symlink_name}" STREQUAL "symlink_to_non_empty_dir")
+ string(REGEX MATCH "^.*${whitespaces}->${whitespaces}non_empty_dir$" check_symlink "${SYMLINK_POINT_}")
+ else()
+ message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'")
+ endif()
+
+ if(NOT check_symlink)
+ message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
new file mode 100644
index 0000000..fef765c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SYMLINKS/test.cmake
@@ -0,0 +1,14 @@
+install(DIRECTORY DESTINATION empty_dir COMPONENT links)
+install(FILES CMakeLists.txt DESTINATION non_empty_dir COMPONENT links)
+
+# test symbolic link to an empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink empty_dir symlink_to_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_empty_dir DESTINATION "." COMPONENT links)
+
+# test symbolic link to a non empty dir
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink non_empty_dir symlink_to_non_empty_dir)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_empty_dir DESTINATION "." COMPONENT links)
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL links)
+endif()
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 9289e84..4e4a030 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 3.8)
project(SourceGroups)
# this is not really a test which can fail
@@ -33,10 +33,11 @@ source_group(EmptyGroup)
set(root ${CMAKE_CURRENT_SOURCE_DIR})
set(tree_files_without_prefix ${root}/sub1/tree_bar.c
- ${root}/sub1/tree_baz.c
- ${root}/sub1/tree_subdir/tree_foobar.c)
+ sub1/tree_baz.c
+ sub1/../sub1/tree_subdir/tree_foobar.c)
-set(tree_files_with_prefix ${root}/tree_foo.c)
+set(tree_files_with_prefix ${root}/tree_prefix_foo.c
+ tree_prefix_bar.c)
source_group(TREE ${root} FILES ${tree_files_without_prefix})
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index b88f2f8..4d84cf2 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -5,7 +5,8 @@ extern int bar(void);
extern int foobar(void);
extern int barbar(void);
extern int baz(void);
-extern int tree_foo(void);
+extern int tree_prefix_foo(void);
+extern int tree_prefix_bar(void);
extern int tree_bar(void);
extern int tree_foobar(void);
extern int tree_baz(void);
@@ -15,7 +16,9 @@ int main()
printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(),
foobar(), barbar(), baz());
- printf("tree_foo: %d tree_bar: %d tree_foobar: %d tree_baz: %d\n",
- tree_foo(), tree_bar(), tree_foobar(), tree_baz());
+ printf("tree_prefix_foo: %d tree_prefix_bar: %d tree_bar: %d tree_foobar: "
+ "%d tree_baz: %d\n",
+ tree_prefix_foo(), tree_prefix_bar(), tree_bar(), tree_foobar(),
+ tree_baz());
return 0;
}
diff --git a/Tests/SourceGroups/tree_foo.c b/Tests/SourceGroups/tree_foo.c
deleted file mode 100644
index d392e41..0000000
--- a/Tests/SourceGroups/tree_foo.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int tree_foo(void)
-{
- return 6;
-}
diff --git a/Tests/SourceGroups/tree_prefix_bar.c b/Tests/SourceGroups/tree_prefix_bar.c
new file mode 100644
index 0000000..bd98476
--- /dev/null
+++ b/Tests/SourceGroups/tree_prefix_bar.c
@@ -0,0 +1,4 @@
+int tree_prefix_bar(void)
+{
+ return 66;
+}
diff --git a/Tests/SourceGroups/tree_prefix_foo.c b/Tests/SourceGroups/tree_prefix_foo.c
new file mode 100644
index 0000000..92c2fd7
--- /dev/null
+++ b/Tests/SourceGroups/tree_prefix_foo.c
@@ -0,0 +1,4 @@
+int tree_prefix_foo(void)
+{
+ return 6;
+}
diff --git a/Tests/Wrapping/fakefluid.cxx b/Tests/Wrapping/fakefluid.cxx
index 02c0c52..a118bbd 100644
--- a/Tests/Wrapping/fakefluid.cxx
+++ b/Tests/Wrapping/fakefluid.cxx
@@ -6,7 +6,9 @@ int main(int ac, char** av)
if (strcmp(av[i], "-o") == 0 || strcmp(av[i], "-h") == 0) {
fprintf(stdout, "fakefluid is creating file \"%s\"\n", av[i + 1]);
FILE* file = fopen(av[i + 1], "w");
- fprintf(file, "// hello\n");
+ fprintf(file, "// Solaris needs non-empty content so ensure\n"
+ "// we have at least one symbol\n"
+ "int Solaris_requires_a_symbol_here = 0;\n");
fclose(file);
}
}