mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:59:06 +08:00
[rpath-test,rpath-test-binaries] Validate rpath fixup (#39319)
This commit is contained in:
parent
3ac0a23d6d
commit
5ac34f9b6f
@ -1,5 +1,6 @@
|
||||
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS_RELEASE
|
||||
@ -8,11 +9,21 @@ vcpkg_cmake_configure(
|
||||
-DTEST_STRING=debug
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
|
||||
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}"
|
||||
)
|
||||
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
|
||||
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/debug"
|
||||
)
|
||||
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
|
||||
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug"
|
||||
)
|
||||
endif()
|
||||
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}")
|
||||
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool AUTO_CLEAN)
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "This test port is part of vcpkg.")
|
||||
|
@ -3,10 +3,15 @@ project(rpath-test CXX)
|
||||
|
||||
set(TEST_STRING "" CACHE STRING "")
|
||||
|
||||
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
|
||||
|
||||
add_library(rpath-backend-lib transitive.cpp)
|
||||
target_compile_definitions(rpath-backend-lib PRIVATE "TEST_STRING=\"${TEST_STRING}\"")
|
||||
|
||||
add_library(rpath-test-lib lib.cpp)
|
||||
target_compile_definitions(rpath-test-lib PRIVATE "TEST_STRING=\"${TEST_STRING}\"")
|
||||
target_link_libraries(rpath-test-lib PRIVATE rpath-backend-lib)
|
||||
|
||||
add_executable(rpath-test-tool main.cpp)
|
||||
target_link_libraries(rpath-test-tool PRIVATE rpath-test-lib)
|
||||
|
||||
install(TARGETS rpath-test-lib rpath-test-tool)
|
||||
install(TARGETS rpath-backend-lib rpath-test-lib rpath-test-tool)
|
||||
|
@ -1,4 +1,6 @@
|
||||
extern const char* getTestStringBackend();
|
||||
|
||||
const char* getTestString()
|
||||
{
|
||||
return TEST_STRING;
|
||||
return getTestStringBackend();
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
const char* getTestStringBackend()
|
||||
{
|
||||
return TEST_STRING;
|
||||
}
|
@ -1,23 +1,31 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_execute_in_download_mode(
|
||||
COMMAND "${CURRENT_INSTALLED_DIR}/tools/rpath-test-binaries/rpath-test-tool"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
|
||||
OUTPUT_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT output STREQUAL "release")
|
||||
message(SEND_ERROR "Actual: '${output}', expected: 'release'")
|
||||
endif()
|
||||
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
vcpkg_execute_in_download_mode(
|
||||
COMMAND "${CURRENT_INSTALLED_DIR}/tools/rpath-test-binaries/debug/rpath-test-tool"
|
||||
foreach(dir IN ITEMS tools/rpath-test-binaries manual-tools/rpath-test-binaries)
|
||||
string(REPLACE "/" "_" logname "execute-rel-${dir}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
|
||||
OUTPUT_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
LOGNAME "${logname}"
|
||||
)
|
||||
if(NOT output STREQUAL "debug")
|
||||
message(SEND_ERROR "Actual: '${output}', expected: 'debug'")
|
||||
if(NOT output STREQUAL "release")
|
||||
message(SEND_ERROR "${dir}: $Actual: '${output}', expected: 'release'")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
foreach(dir IN ITEMS tools/rpath-test-binaries/debug manual-tools/rpath-test-binaries/debug debug/tools/rpath-test-binaries)
|
||||
string(REPLACE "/" "_" logname "execute-dbg-${dir}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
|
||||
OUTPUT_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
LOGNAME "${logname}"
|
||||
)
|
||||
if(NOT output STREQUAL "debug")
|
||||
message(SEND_ERROR "${dir}: Actual: '${output}', expected: 'debug'")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user