Add tests for BUNDLE_EXTENSION

This commit is contained in:
Gregor Jasny 2016-07-18 09:11:44 -07:00
parent c63380b195
commit f951d0adb4
3 changed files with 64 additions and 4 deletions

View File

@ -31,13 +31,16 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DTEST_IOS=OFF")
set(RunCMake_TEST_OPTIONS
"-DTEST_IOS=OFF"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeBundles)
run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@ -45,13 +48,16 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DTEST_IOS=ON")
set(RunCMake_TEST_OPTIONS
"-DTEST_IOS=ON"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeBundles)
run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@ -61,13 +67,16 @@ endif()
if(NOT XCODE_VERSION VERSION_LESS 7)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DTEST_WATCHOS=ON")
set(RunCMake_TEST_OPTIONS
"-DTEST_WATCHOS=ON"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeBundles)
run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@ -77,13 +86,16 @@ endif()
if(NOT XCODE_VERSION VERSION_LESS 7.1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DTEST_TVOS=ON")
set(RunCMake_TEST_OPTIONS
"-DTEST_TVOS=ON"
"-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install")
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeBundles)
run_cmake_command(XcodeBundles-build ${CMAKE_COMMAND} --build .)
run_cmake_command(XcodeBundles-install ${CMAKE_COMMAND} --build . --target install)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)

View File

@ -0,0 +1,8 @@
file(GLOB DIRECTORIES LIST_DIRECTORIES true
"${RunCMake_TEST_BINARY_DIR}/_install/FooExtension/*.*")
foreach(DIRECTORY IN LISTS DIRECTORIES)
if(NOT DIRECTORY MATCHES "\\.foo$")
message(SEND_ERROR "Extension does not match ${DIRECTORY}")
endif()
endforeach()

View File

@ -36,6 +36,20 @@ add_custom_target(AppBundleTest ALL
add_dependencies(AppBundleTest AppBundle)
# with custom extension
if (NOT TEST_IOS AND NOT TEST_WATCHOS AND NOT TEST_TVOS)
add_executable(AppBundleExt MACOSX_BUNDLE main.m)
set_target_properties(AppBundleExt PROPERTIES BUNDLE_EXTENSION "foo")
install(TARGETS AppBundleExt BUNDLE DESTINATION FooExtension)
add_custom_target(AppBundleExtTest ALL
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:AppBundleExt>" "$<TARGET_FILE:AppBundleExt>.old")
add_dependencies(AppBundleExtTest AppBundleExt)
endif()
# Framework (not supported for iOS on Xcode < 6)
if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
@ -47,6 +61,19 @@ if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6)
"$<TARGET_FILE:Framework>" "$<TARGET_FILE:Framework>.old")
add_dependencies(FrameworkTest Framework)
# with custom extension
add_library(FrameworkExt SHARED main.c)
set_target_properties(FrameworkExt PROPERTIES FRAMEWORK TRUE)
set_target_properties(FrameworkExt PROPERTIES BUNDLE_EXTENSION "foo")
install(TARGETS FrameworkExt FRAMEWORK DESTINATION FooExtension)
add_custom_target(FrameworkExtTest ALL
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:FrameworkExt>" "$<TARGET_FILE:FrameworkExt>.old")
add_dependencies(FrameworkExtTest FrameworkExt)
endif()
# Bundle
@ -60,4 +87,17 @@ if(NOT CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE)
"$<TARGET_FILE:Bundle>" "$<TARGET_FILE:Bundle>.old")
add_dependencies(BundleTest Bundle)
# with custom extension
add_library(BundleExt MODULE main.c)
set_target_properties(BundleExt PROPERTIES BUNDLE TRUE)
set_target_properties(BundleExt PROPERTIES BUNDLE_EXTENSION "foo")
install(TARGETS BundleExt LIBRARY DESTINATION FooExtension)
add_custom_target(BundleExtTest ALL
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:BundleExt>" "$<TARGET_FILE:BundleExt>.old")
add_dependencies(BundleExtTest BundleExt)
endif()