diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/Ninja/Intl-build-check.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/Intl-common.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/Intl.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 9 | ||||
-rw-r--r-- | Tests/SwiftMix/CMain.c | 13 | ||||
-rw-r--r-- | Tests/SwiftMix/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/SwiftMix/SwiftMain.swift | 20 |
8 files changed, 61 insertions, 4 deletions
diff --git a/Tests/RunCMake/Ninja/Intl-build-check.cmake b/Tests/RunCMake/Ninja/Intl-build-check.cmake new file mode 100644 index 0000000..77f013c --- /dev/null +++ b/Tests/RunCMake/Ninja/Intl-build-check.cmake @@ -0,0 +1,5 @@ +include(${RunCMake_SOURCE_DIR}/Intl-common.cmake) +set(output "${RunCMake_TEST_BINARY_DIR}/${intl}-output.txt") +if(NOT EXISTS "${output}") + set(RunCMake_TEST_FAILED "Expected output does not exist:\n ${output}") +endif() diff --git a/Tests/RunCMake/Ninja/Intl-common.cmake b/Tests/RunCMake/Ninja/Intl-common.cmake new file mode 100644 index 0000000..7703976 --- /dev/null +++ b/Tests/RunCMake/Ninja/Intl-common.cmake @@ -0,0 +1 @@ +set(intl "intl-ë®") diff --git a/Tests/RunCMake/Ninja/Intl.cmake b/Tests/RunCMake/Ninja/Intl.cmake new file mode 100644 index 0000000..50e4ee4 --- /dev/null +++ b/Tests/RunCMake/Ninja/Intl.cmake @@ -0,0 +1,7 @@ +include(Intl-common.cmake) +set(input "${CMAKE_CURRENT_BINARY_DIR}/${intl}-input.txt") +set(output "${CMAKE_CURRENT_BINARY_DIR}/${intl}-output.txt") +file(WRITE "${input}" "${intl}\n") +add_custom_command(OUTPUT "${output}" + COMMAND ${CMAKE_COMMAND} -E copy "${input}" "${output}") +add_custom_target(drive ALL DEPENDS "${output}") diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 9f078e6..44a7ba1 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -33,6 +33,15 @@ function(run_NinjaToolMissing) endfunction() run_NinjaToolMissing() +function(run_Intl) + run_cmake(Intl) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Intl-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(Intl-build ${CMAKE_COMMAND} --build .) +endfunction() +run_Intl() + function(run_NoWorkToDo) run_cmake(NoWorkToDo) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index a3a3451..7245471 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -95,10 +95,11 @@ run_cmake(Inspect) include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") # FIXME: Support more compilers and default standard levels. -if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|AppleClang)$" - AND DEFINED CMAKE_CXX_STANDARD_DEFAULT - AND DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT - ) +if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND + DEFINED CMAKE_CXX_EXTENSIONS_DEFAULT AND ( + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.7) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + )) run_cmake(CMP0128-WARN) if(NOT CMAKE_CXX_STANDARD_DEFAULT EQUAL 11) run_cmake(CMP0128-NEW) diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c index 519058e..b274322 100644 --- a/Tests/SwiftMix/CMain.c +++ b/Tests/SwiftMix/CMain.c @@ -1,3 +1,16 @@ +#if !defined(FOO) +# error "FOO not defined" +#endif +#if BAR != 3 +# error "FOO not defined to 3" +#endif +#if CCOND != 2 +# error "CCOND not defined to 2" +#endif +#if defined(SWIFTCOND) +# error "SWIFTCOND defined" +#endif + extern int ObjCMain(void); int main(void) { diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt index 6d8e48b..e8b6521 100644 --- a/Tests/SwiftMix/CMakeLists.txt +++ b/Tests/SwiftMix/CMakeLists.txt @@ -4,3 +4,4 @@ project(SwiftMix C Swift) add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h) set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h") target_compile_options(SwiftMix PRIVATE "$<$<COMPILE_LANGUAGE:C>:-Werror=objc-method-access>") +target_compile_definitions(SwiftMix PRIVATE "$<IF:$<COMPILE_LANGUAGE:Swift>,SWIFTCOND,CCOND=2>" FOO BAR=3) diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift index d9c8cd7..238059d 100644 --- a/Tests/SwiftMix/SwiftMain.swift +++ b/Tests/SwiftMix/SwiftMain.swift @@ -3,6 +3,26 @@ import Foundation @objc class SwiftMainClass : NSObject { @objc class func SwiftMain() -> Int32 { dump("Hello World!"); +#if FOO + dump("FOO defined"); +#else + fatalError("FOO not defined"); +#endif +#if BAR + dump("BAR defined"); +#else + fatalError("BAR not defined"); +#endif +#if CCOND + fatalError("CCOND defined"); +#else + dump("CCOND not defined"); +#endif +#if SWIFTCOND + dump("SWIFTCOND defined"); +#else + fatalError("SWIFTCOND not defined"); +#endif return 0; } } |