diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2024-03-14 13:33:48 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2024-03-14 13:33:48 (GMT) |
commit | bcc26ce465d868edb5ca551c0a1e734740afb58d (patch) | |
tree | 47839895a31d420caf574847a3b23709a11d506e | |
parent | 886333da388c6c66d3073d73665118c55f693eaf (diff) | |
download | CMake-bcc26ce465d868edb5ca551c0a1e734740afb58d.zip CMake-bcc26ce465d868edb5ca551c0a1e734740afb58d.tar.gz CMake-bcc26ce465d868edb5ca551c0a1e734740afb58d.tar.bz2 |
Apple Text Based Stubs: should be usage in subdirectories
Fixes: #25765
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Tests/RunCMake/AppleTextStubs/SUBDIR/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/AppleTextStubs/Simple.cmake | 12 |
3 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index bc48a3b..481c52d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -978,6 +978,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( auto genStubsRule = this->Makefile->GetDefinition("CMAKE_CREATE_TEXT_STUBS"); cmList genStubs_commands{ genStubsRule }; + this->LocalGenerator->CreateCDCommand( + genStubs_commands, this->Makefile->GetCurrentBinaryDirectory(), + this->LocalGenerator->GetBinaryDirectory()); std::string TBDFullPath = cmStrCat(outpathImp, this->TargetNames.ImportOutput); diff --git a/Tests/RunCMake/AppleTextStubs/SUBDIR/CMakeLists.txt b/Tests/RunCMake/AppleTextStubs/SUBDIR/CMakeLists.txt new file mode 100644 index 0000000..61cfefe --- /dev/null +++ b/Tests/RunCMake/AppleTextStubs/SUBDIR/CMakeLists.txt @@ -0,0 +1,5 @@ + +add_library(foo2 SHARED ../foo.c) +set_property(TARGET foo2 PROPERTY ENABLE_EXPORTS TRUE) + +install(TARGETS foo2 DESTINATION "${CMAKE_BINARY_DIR}/INSTALL") diff --git a/Tests/RunCMake/AppleTextStubs/Simple.cmake b/Tests/RunCMake/AppleTextStubs/Simple.cmake index 9f6318c..8491267 100644 --- a/Tests/RunCMake/AppleTextStubs/Simple.cmake +++ b/Tests/RunCMake/AppleTextStubs/Simple.cmake @@ -6,6 +6,7 @@ set_property(TARGET foo PROPERTY ENABLE_EXPORTS TRUE) add_executable(main main.c) target_link_libraries(main PRIVATE foo) +add_subdirectory(SUBDIR) install(TARGETS foo DESTINATION "${CMAKE_BINARY_DIR}/INSTALL") @@ -24,15 +25,20 @@ macro (CHECK_FILE test_msg path) endif() endmacro() -check_file("DYLIB file" "$<TARGET_FILE:foo>") +check_file("foo DYLIB file" "$<TARGET_FILE:foo>") +check_file("foo2 DYLIB file" "$<TARGET_FILE:foo2>") check_file("executable file" "$<TARGET_FILE:main>") +check_file("Installed foo DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_FILE_NAME:foo>") +check_file("Installed foo2 DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_FILE_NAME:foo2>") check_file("Installed DYLIB file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/lib/$<TARGET_FILE_NAME:foo>") if (APPLE_TEXT_STUBS_SUPPORTED) - check_file("TBD file" "$<TARGET_IMPORT_FILE:foo>") + check_file("foo TBD file" "$<TARGET_IMPORT_FILE:foo>") + check_file("foo2 TBD file" "$<TARGET_IMPORT_FILE:foo2>") - check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_IMPORT_FILE_NAME:foo>") + check_file("Installed foo TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_IMPORT_FILE_NAME:foo>") + check_file("Installed foo2 TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL/$<TARGET_IMPORT_FILE_NAME:foo2>") check_file("Installed TBD file" "${RunCMake_TEST_BINARY_DIR}/INSTALL2/dev/$<TARGET_IMPORT_FILE_NAME:foo>") endif() ]]) |