From 207b7af00be53f0779c4896f311f130455d3aadd Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 16 Dec 2014 22:22:07 +0100 Subject: [PATCH 1/3] cmTarget: Use GetCFBundleDirectory within GetFullNameInternal Replace duplicated code by call to GetCFBundleDirectory. Signed-off-by: Gregor Jasny --- Source/cmTarget.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 37aa26e34..9c4801eaa 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4056,15 +4056,8 @@ void cmTarget::GetFullNameInternal(const std::string& config, if(this->IsCFBundleOnApple()) { - fw_prefix = this->GetOutputName(config, false); - fw_prefix += "."; - const char *ext = this->GetProperty("BUNDLE_EXTENSION"); - if (!ext) - { - ext = "bundle"; - } - fw_prefix += ext; - fw_prefix += "/Contents/MacOS/"; + fw_prefix = this->GetCFBundleDirectory(config, false); + fw_prefix += "/"; targetPrefix = fw_prefix.c_str(); targetSuffix = 0; } From 3a605693a5349a252bb9c3eb472d02b1c23886e3 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 16 Dec 2014 22:22:08 +0100 Subject: [PATCH 2/3] Xcode: Call IsCFBundleOnApple to decide if bundle is being built Narrow down the decision if a CFBundle is built to one place. This is a preparation patch to add another target property which, if set, will imply BUNDLE. Having only one function which will have to look at both properties helps to keep code clean. Signed-off-by: Gregor Jasny --- Source/cmGlobalXCodeGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index de6e91546..6a480a9c9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1925,7 +1925,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("BUNDLE")); - if (target.GetPropertyAsBool("BUNDLE")) + if (target.IsCFBundleOnApple()) { // It turns out that a BUNDLE is basically the same // in many ways as an application bundle, as far as From b189c5994d94b8dd0afdf14844db4a4be28cf4b1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Dec 2014 11:42:19 -0500 Subject: [PATCH 3/3] Tests: Run CFBundleTest only with valid configuration The verification script needs to know the configuration tested. --- Tests/CFBundleTest/VerifyResult.cmake | 9 +++------ Tests/CMakeLists.txt | 5 +++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Tests/CFBundleTest/VerifyResult.cmake b/Tests/CFBundleTest/VerifyResult.cmake index e62290052..e637bb142 100644 --- a/Tests/CFBundleTest/VerifyResult.cmake +++ b/Tests/CFBundleTest/VerifyResult.cmake @@ -14,13 +14,10 @@ message(STATUS "CTEST_CONFIGURATION_TYPE='${CTEST_CONFIGURATION_TYPE}'") message(STATUS "dir='${dir}'") message(STATUS "gen='${gen}'") -if(gen MATCHES "Make" OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "" OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "." OR - "${CTEST_CONFIGURATION_TYPE}" STREQUAL "NoConfig") - set(expected_filename "${dir}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") -else() +if(gen STREQUAL "Xcode") set(expected_filename "${dir}/${CTEST_CONFIGURATION_TYPE}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") +else() + set(expected_filename "${dir}/CFBundleTest.plugin/Contents/MacOS/CFBundleTest") endif() if(NOT EXISTS "${expected_filename}") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 33c18ce2a..568fc8694 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1935,16 +1935,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest") - add_test(CFBundleTest ${CMAKE_CTEST_COMMAND} + add_test(NAME CFBundleTest COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CFBundleTest" "${CMake_BINARY_DIR}/Tests/CFBundleTest" --build-two-config ${build_generator_args} --build-project CFBundleTest + --build-config $ --build-options ${build_options} --test-command - ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} + ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=$ -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest -Dgen=${CMAKE_GENERATOR} -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake)