summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-03 13:34:01 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-03 13:39:03 (GMT)
commit4684e64c84d49d9152ebab42c8bc4ffa57652041 (patch)
treee11975348641bcc2da212e491b75e4f181aeaa72 /Tests
parent54b69bd6426bffae6ba11b4d0d95a4ad8c31b309 (diff)
parentdca9c33abc7ce6b041b378e1ebc43c35327027b3 (diff)
downloadCMake-4684e64c84d49d9152ebab42c8bc4ffa57652041.zip
CMake-4684e64c84d49d9152ebab42c8bc4ffa57652041.tar.gz
CMake-4684e64c84d49d9152ebab42c8bc4ffa57652041.tar.bz2
Merge topic 'clang-ipo-support'
dca9c33abc Tests: Remove old IPO test c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm 079b8e2916 Clang: prefer lld-link over link.exe 6e3655db2c Clang: add LTO support for GNU-command line clang on windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3527
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/IPO/CMakeLists.txt7
-rw-r--r--Tests/Module/CheckIPOSupported-C/CMakeLists.txt12
-rw-r--r--Tests/Module/CheckIPOSupported-C/bar.c4
-rw-r--r--Tests/Module/CheckIPOSupported-C/main.c3
-rw-r--r--Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt15
-rw-r--r--Tests/Module/CheckIPOSupported-CXX/bar.cpp4
-rw-r--r--Tests/Module/CheckIPOSupported-CXX/main.cpp3
8 files changed, 36 insertions, 13 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index cbd7d56..c14107a 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -416,7 +416,6 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
- ADD_TEST_MACRO(IPO COnly/COnly)
ADD_TEST_MACRO(OutDir runtime/OutDir)
ADD_TEST_MACRO(OutName exe.OutName.exe)
ADD_TEST_MACRO(ObjectLibrary UseCshared)
diff --git a/Tests/IPO/CMakeLists.txt b/Tests/IPO/CMakeLists.txt
deleted file mode 100644
index 6dabf86..0000000
--- a/Tests/IPO/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_minimum_required (VERSION 2.8)
-project(IPO NONE)
-
-set_property(DIRECTORY PROPERTY INTERPROCEDURAL_OPTIMIZATION 1)
-
-add_subdirectory(../COnly COnly)
-add_subdirectory(../CxxOnly CxxOnly)
diff --git a/Tests/Module/CheckIPOSupported-C/CMakeLists.txt b/Tests/Module/CheckIPOSupported-C/CMakeLists.txt
index 4a41a98..c5cd03e 100644
--- a/Tests/Module/CheckIPOSupported-C/CMakeLists.txt
+++ b/Tests/Module/CheckIPOSupported-C/CMakeLists.txt
@@ -13,8 +13,18 @@ elseif(CMake_TEST_IPO_WORKS_C)
endif()
add_library(foo foo.c)
+if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
+ add_library(bar SHARED bar.c)
+ if(WIN32)
+ # Bindexplib for clang supports LTO objects
+ set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ endif()
+else()
+ # TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows
+ add_library(bar STATIC bar.c)
+endif()
add_executable(CheckIPOSupported-C main.c)
-target_link_libraries(CheckIPOSupported-C PUBLIC foo)
+target_link_libraries(CheckIPOSupported-C PUBLIC foo bar)
enable_testing()
add_test(NAME CheckIPOSupported-C COMMAND CheckIPOSupported-C)
diff --git a/Tests/Module/CheckIPOSupported-C/bar.c b/Tests/Module/CheckIPOSupported-C/bar.c
new file mode 100644
index 0000000..680f213
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-C/bar.c
@@ -0,0 +1,4 @@
+int bar()
+{
+ return 0x42;
+}
diff --git a/Tests/Module/CheckIPOSupported-C/main.c b/Tests/Module/CheckIPOSupported-C/main.c
index 99204ab..28ab26f 100644
--- a/Tests/Module/CheckIPOSupported-C/main.c
+++ b/Tests/Module/CheckIPOSupported-C/main.c
@@ -1,8 +1,9 @@
int foo();
+int bar();
int main()
{
- if (foo() == 0) {
+ if (foo() != bar()) {
return 1;
}
return 0;
diff --git a/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt b/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt
index 1bb2b84..237bf1d 100644
--- a/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt
+++ b/Tests/Module/CheckIPOSupported-CXX/CMakeLists.txt
@@ -12,9 +12,20 @@ elseif(CMake_TEST_IPO_WORKS_CXX)
message(FATAL_ERROR "IPO expected to work, but the check failed:\n ${ipo_output}")
endif()
-add_library(foo foo.cpp)
+
+add_library(foo STATIC foo.cpp)
+if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
+ add_library(bar SHARED bar.cpp)
+ if(WIN32)
+ # Bindexplib for clang supports LTO objects
+ set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ endif()
+else()
+ # TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows
+ add_library(bar STATIC bar.cpp)
+endif()
add_executable(CheckIPOSupported-CXX main.cpp)
-target_link_libraries(CheckIPOSupported-CXX PUBLIC foo)
+target_link_libraries(CheckIPOSupported-CXX PUBLIC foo bar)
enable_testing()
add_test(NAME CheckIPOSupported-CXX COMMAND CheckIPOSupported-CXX)
diff --git a/Tests/Module/CheckIPOSupported-CXX/bar.cpp b/Tests/Module/CheckIPOSupported-CXX/bar.cpp
new file mode 100644
index 0000000..680f213
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-CXX/bar.cpp
@@ -0,0 +1,4 @@
+int bar()
+{
+ return 0x42;
+}
diff --git a/Tests/Module/CheckIPOSupported-CXX/main.cpp b/Tests/Module/CheckIPOSupported-CXX/main.cpp
index 99204ab..28ab26f 100644
--- a/Tests/Module/CheckIPOSupported-CXX/main.cpp
+++ b/Tests/Module/CheckIPOSupported-CXX/main.cpp
@@ -1,8 +1,9 @@
int foo();
+int bar();
int main()
{
- if (foo() == 0) {
+ if (foo() != bar()) {
return 1;
}
return 0;