diff options
author | Brad King <brad.king@kitware.com> | 2020-12-01 14:30:41 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-12-01 14:33:36 (GMT) |
commit | f07b9d9e51fab3ac203ca6d1e6fd9bd8833e9388 (patch) | |
tree | 964579134769fdaa1888d11389959fcf056d75ff | |
parent | cbe2c0119d9de46f060ea893b4d1262bfde86f96 (diff) | |
parent | 31d3e64080c950b1f201b0fb9040937a8af1cda9 (diff) | |
download | CMake-f07b9d9e51fab3ac203ca6d1e6fd9bd8833e9388.zip CMake-f07b9d9e51fab3ac203ca6d1e6fd9bd8833e9388.tar.gz CMake-f07b9d9e51fab3ac203ca6d1e6fd9bd8833e9388.tar.bz2 |
Merge topic 'xcode-check-object-lib-subprojects-fixed'
31d3e64080 Tests: Add Xcode cases fixed by switch to the "new build system"
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5549
4 files changed, 70 insertions, 0 deletions
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 62163ac..abba741 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -51,6 +51,35 @@ run_cmake(PerConfigPerSourceOptions) run_cmake(PerConfigPerSourceDefinitions) run_cmake(PerConfigPerSourceIncludeDirs) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + + function(XcodeObjectLibsInTwoProjectsiOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-ios) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS") + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-ios ${CMAKE_COMMAND} --build . --target shared_lib -- -sdk iphonesimulator) + endfunction() + + XcodeObjectLibsInTwoProjectsiOS() + + function(XcodeObjectLibsInTwoProjectsMacOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-macos) + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-macos ${CMAKE_COMMAND} --build . --target shared_lib) + endfunction() + + XcodeObjectLibsInTwoProjectsMacOS() + +endif() + function(XcodeSchemaGeneration) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake new file mode 100644 index 0000000..3ca24af --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required (VERSION 3.19) + +project (test_xcode_fail NONE) + +add_subdirectory(subproject_two_object_libs) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt new file mode 100644 index 0000000..e55836d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 3.16) + +enable_language(CXX) + +project (subproject_two_object_libs) + +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + +if(IOS) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") +endif() + +# Hierarchy of libraries looks like: +# +# OBJECT-1 ---> STATIC--\ +# |---> SHARED +# OBJECT-2 -------------/ + +add_library(object_lib_dependency1 OBJECT dummy.cpp) + +add_library(static_lib_dependency STATIC dummy.cpp $<TARGET_OBJECTS:object_lib_dependency1>) + +add_library(object_lib_dependency2 OBJECT dummy.cpp) +target_link_libraries(object_lib_dependency2 PRIVATE static_lib_dependency) + +add_library(shared_lib SHARED dummy.cpp) +target_link_libraries(shared_lib PRIVATE static_lib_dependency) +target_sources(shared_lib PRIVATE $<TARGET_OBJECTS:object_lib_dependency2>) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp new file mode 100644 index 0000000..8082abc --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp @@ -0,0 +1,5 @@ +namespace { +void foo() +{ +} +} |