mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 13:19:51 -05:00
bindexplib: supporting llvm bitcode formats using llvm-nm
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
int bar()
|
||||
{
|
||||
return 0x42;
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
int foo();
|
||||
int bar();
|
||||
|
||||
int main()
|
||||
{
|
||||
if (foo() == 0) {
|
||||
if (foo() != bar()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
int bar()
|
||||
{
|
||||
return 0x42;
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
int foo();
|
||||
int bar();
|
||||
|
||||
int main()
|
||||
{
|
||||
if (foo() == 0) {
|
||||
if (foo() != bar()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user