summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Framework
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2016-12-26 17:07:24 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-31 13:59:15 (GMT)
commit071f8e78dda152d8759539fa390b25c7f58d3cc5 (patch)
tree0f9e71cbe2e9556d44079a4311f53ec343bf3236 /Tests/RunCMake/Framework
parentd525754eabef7a9f6e6696ae323a8ed965e12f2e (diff)
downloadCMake-071f8e78dda152d8759539fa390b25c7f58d3cc5.zip
CMake-071f8e78dda152d8759539fa390b25c7f58d3cc5.tar.gz
CMake-071f8e78dda152d8759539fa390b25c7f58d3cc5.tar.bz2
Apple: Add support for static frameworks
Closes: #16432
Diffstat (limited to 'Tests/RunCMake/Framework')
-rw-r--r--Tests/RunCMake/Framework/FrameworkLayout.cmake5
-rw-r--r--Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Framework/RunCMakeTest.cmake29
4 files changed, 31 insertions, 5 deletions
diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake
index 5184755..ae32134 100644
--- a/Tests/RunCMake/Framework/FrameworkLayout.cmake
+++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.4)
enable_language(C)
-add_library(Framework SHARED
+add_library(Framework ${FRAMEWORK_TYPE}
foo.c
foo.h
res.txt)
@@ -9,3 +9,6 @@ set_target_properties(Framework PROPERTIES
FRAMEWORK TRUE
PUBLIC_HEADER foo.h
RESOURCE "res.txt")
+
+add_custom_command(TARGET Framework POST_BUILD
+ COMMAND /usr/bin/file $<TARGET_FILE:Framework>)
diff --git a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt
new file mode 100644
index 0000000..8d90f5f
--- /dev/null
+++ b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt
@@ -0,0 +1 @@
+.*/Framework: Mach-O[^\n]* dynamically linked shared library.*
diff --git a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt
new file mode 100644
index 0000000..c9f50b6
--- /dev/null
+++ b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt
@@ -0,0 +1 @@
+.*/Framework: current ar archive random library.*
diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake
index 1f7d54e..e64892d 100644
--- a/Tests/RunCMake/Framework/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake
@@ -1,9 +1,10 @@
include(RunCMake)
-function(framework_layout_test Name Toolchain)
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}FrameworkLayout-build)
+function(framework_layout_test Name Toolchain Type)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${Toolchain}.cmake")
+ list(APPEND RunCMake_TEST_OPTIONS "-DFRAMEWORK_TYPE=${Type}")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
@@ -14,6 +15,26 @@ endfunction()
# build check cannot cope with multi-configuration generators directory layout
if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
- framework_layout_test(iOSFrameworkLayout-build ios)
- framework_layout_test(OSXFrameworkLayout-build osx)
+ framework_layout_test(iOSFrameworkLayout-build ios SHARED)
+ framework_layout_test(iOSFrameworkLayout-build ios STATIC)
+ framework_layout_test(OSXFrameworkLayout-build osx SHARED)
+ framework_layout_test(OSXFrameworkLayout-build osx STATIC)
endif()
+
+function(framework_type_test Toolchain Type)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkType-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${Toolchain}.cmake")
+ list(APPEND RunCMake_TEST_OPTIONS "-DFRAMEWORK_TYPE=${Type}")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(FrameworkLayout)
+ run_cmake_command(FrameworkType${Type}-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+framework_type_test(ios SHARED)
+framework_type_test(ios STATIC)
+framework_type_test(osx SHARED)
+framework_type_test(osx STATIC)