diff options
author | Lucas SOLTIC <lucas.soltic@orange.fr> | 2021-09-13 22:37:48 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-09-13 22:39:22 (GMT) |
commit | 6ef7bfbb645c9f232b41b66b8fb334da8b5ca947 (patch) | |
tree | 990531a4fefc1396549b3e09ac12145383585d41 /Tests/RunCMake/XcodeProject-Embed | |
parent | b7bcf70761b0008697074073b161f2569e8b46cb (diff) | |
download | CMake-6ef7bfbb645c9f232b41b66b8fb334da8b5ca947.zip CMake-6ef7bfbb645c9f232b41b66b8fb334da8b5ca947.tar.gz CMake-6ef7bfbb645c9f232b41b66b8fb334da8b5ca947.tar.bz2 |
Xcode: add support for embedding dynamic libraries
Diffstat (limited to 'Tests/RunCMake/XcodeProject-Embed')
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/ExternalDependencies.cmake (renamed from Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake) | 2 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake | 36 |
7 files changed, 28 insertions, 24 deletions
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake index f4fe07f..54375d5 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake @@ -1,7 +1,7 @@ add_executable(app MACOSX_BUNDLE main.m) set_target_properties(app PROPERTIES - XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_DEPENDENCY}" XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY OFF XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY OFF ) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake index e4ea55d..23fd49d 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake @@ -1,3 +1,3 @@ -if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/sharedFrameworkExt.framework) - set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location") +if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/${EXTERNAL_DEPENDENCY_NAME}) + set(RunCMake_TEST_FAILED "${EXTERNAL_DEPENDENCY_NAME} was not embedded at the expected location") endif() diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake index 79d8d77..c76226f 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake @@ -1,7 +1,7 @@ add_executable(app MACOSX_BUNDLE main.m) set_target_properties(app PROPERTIES - XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_DEPENDENCY}" XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON ) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake index 57c79ea..732f04c 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake @@ -1,3 +1,3 @@ -if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/subdir/sharedFrameworkExt.framework) - set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location") +if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/subdir/${EXTERNAL_DEPENDENCY_NAME}) + set(RunCMake_TEST_FAILED "${EXTERNAL_DEPENDENCY_NAME} was not embedded at the expected location") endif() diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake index 4c78199..f83b1bf 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake @@ -1,7 +1,7 @@ add_executable(app MACOSX_BUNDLE main.m) set_target_properties(app PROPERTIES - XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_DEPENDENCY}" XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON XCODE_EMBED_FRAMEWORKS_PATH "subdir" diff --git a/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake b/Tests/RunCMake/XcodeProject-Embed/ExternalDependencies.cmake index 64e2f95..8c7b06a 100644 --- a/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/ExternalDependencies.cmake @@ -1,2 +1,4 @@ add_library(sharedFrameworkExt SHARED func.m) set_target_properties(sharedFrameworkExt PROPERTIES FRAMEWORK TRUE) + +add_library(sharedDylibExt SHARED func.m) diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index e94d084..f3a6918 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -1,47 +1,49 @@ include(RunCMake) -# Build a framework that the other tests will use and treat as external. +# Build dependencies that the other tests will use and treat as external. # Always build in the Debug configuration so that the path to the framework # is predictable. -function(ExternalFramework) +function(ExternalDependencies) set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalFramework-build) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalDependencies-build) set(externalFramework ${RunCMake_TEST_BINARY_DIR}/Debug/sharedFrameworkExt.framework PARENT_SCOPE) + set(externalDylib ${RunCMake_TEST_BINARY_DIR}/Debug/libsharedDylibExt.dylib PARENT_SCOPE) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(ExternalFramework) - run_cmake_command(ExternalFramework-build + run_cmake(ExternalDependencies) + run_cmake_command(ExternalDependencies-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Debug - --target sharedFrameworkExt + --target sharedFrameworkExt sharedDylibExt ) endfunction() -ExternalFramework() +ExternalDependencies() -set(RunCMake_TEST_OPTIONS -DEXTERNAL_FWK=${externalFramework}) - -run_cmake(EmbedFrameworksFlagsOff) - -function(TestFlagsOn testName) +function(TestFlagsOn testName dependencyName) set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-${dependencyName}-build) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(${testName}) - run_cmake_command(${testName}-build + run_cmake_command(${testName}-${dependencyName}-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Debug --target app ) endfunction() -TestFlagsOn(EmbedFrameworksFlagsOnNoSubdir) -TestFlagsOn(EmbedFrameworksFlagsOnWithSubdir) - +foreach(dependency ${externalFramework} ${externalDylib}) + cmake_path(GET dependency FILENAME dependencyName) + set(RunCMake_TEST_OPTIONS -DEXTERNAL_DEPENDENCY=${dependency} -DEXTERNAL_DEPENDENCY_NAME=${dependencyName}) + run_cmake(EmbedFrameworksFlagsOff) + TestFlagsOn(EmbedFrameworksFlagsOnNoSubdir ${dependencyName}) + TestFlagsOn(EmbedFrameworksFlagsOnWithSubdir ${dependencyName}) +endforeach() +unset(RunCMake_TEST_OPTIONS) function(TestAppExtension platform) set(testName EmbedAppExtensions-${platform}) |