diff options
Diffstat (limited to 'Tests')
55 files changed, 323 insertions, 78 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8b38a70..08bfebe 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -390,6 +390,9 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) ADD_TEST_MACRO(SourceFileProperty SourceFileProperty) + if (NOT CMAKE_GENERATOR STREQUAL "Xcode") + ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty) + endif() if(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(runCxxDialectTest 1) @@ -3194,29 +3197,51 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --test-command ${JAVA_RUNTIME} -classpath hello3.jar HelloWorld) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput") - # For next test, java tool must have same architecture as toolchain + # For next tests, java tool must have same architecture as toolchain math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") execute_process( COMMAND "${Java_JAVA_EXECUTABLE}" -d${_object_mode} -version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result ) if(_result EQUAL 0) - if(_isMultiConfig) - set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>) - else() - set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah) + ## next test is valid only if Java version is less than 1.10 + if ("${Java_VERSION}" VERSION_LESS 1.10) + if(_isMultiConfig) + set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>) + else() + set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah) + endif() + add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaJavah" + "${CMake_BINARY_DIR}/Tests/JavaJavah" + ${build_generator_args} + --build-project helloJavah + --build-two-config + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" + --build-options ${build_options} + --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") + endif() + ## next test is valid only if Java is, at least, version 1.8 + if (NOT "${Java_VERSION}" VERSION_LESS 1.8) + if(_isMultiConfig) + set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/$<CONFIGURATION>) + else() + set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders) + endif() + add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" + "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders" + ${build_generator_args} + --build-project helloJavaNativeHeaders + --build-two-config + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/" + --build-options ${build_options} + --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVANATIVEHEADERS_LIBRARY_PATH} -classpath hello4.jar HelloWorld3) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders") endif() - add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/JavaJavah" - "${CMake_BINARY_DIR}/Tests/JavaJavah" - ${build_generator_args} - --build-project helloJavah - --build-two-config - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" - --build-options ${build_options} - --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") endif() endif() endif() diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4586357..19d12e5 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -260,17 +260,49 @@ add_custom_target(check-part4 ALL #----------------------------------------------------------------------------- # Cover source file properties with generator expressions. -add_executable(srcgenex_flags srcgenex_flags.c) -set_property(SOURCE srcgenex_flags.c PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>") - -add_executable(srcgenex_flags_COMPILE_LANGUAGE srcgenex_flags_COMPILE_LANGUAGE.c) -set_property(SOURCE srcgenex_flags_COMPILE_LANGUAGE.c PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>") - -add_executable(srcgenex_defs srcgenex_defs.c) -set_property(SOURCE srcgenex_defs.c PROPERTY COMPILE_DEFINITIONS NAME=$<TARGET_PROPERTY:NAME>) - -add_executable(srcgenex_defs_COMPILE_LANGUAGE srcgenex_defs_COMPILE_LANGUAGE.c) -set_property(SOURCE srcgenex_defs_COMPILE_LANGUAGE.c PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>) +## generate various source files +foreach (item IN ITEMS flags flags_COMPILE_LANGUAGE + options options_COMPILE_LANGUAGE + defs defs_COMPILE_LANGUAGE) + set(TARGET_NAME srcgenex_${item}) + configure_file(srcgenex.c.in ${TARGET_NAME}.c @ONLY) +endforeach() +add_executable(srcgenex_flags "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags.c" + PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>") +add_executable(srcgenex_flags_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_flags_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_FLAGS "$<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>") + +add_executable(srcgenex_options "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options.c" + PROPERTY COMPILE_OPTIONS -DUNUSED -DNAME=$<TARGET_PROPERTY:NAME>) +add_executable(srcgenex_options_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_options_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:C>:-DNAME=$<TARGET_PROPERTY:NAME>>) + +add_executable(srcgenex_defs "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs.c" + PROPERTY COMPILE_DEFINITIONS UNUSED NAME=$<TARGET_PROPERTY:NAME>) +add_executable(srcgenex_defs_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_defs_COMPILE_LANGUAGE.c" + PROPERTY COMPILE_DEFINITIONS $<$<COMPILE_LANGUAGE:C>:NAME=$<TARGET_PROPERTY:NAME>>) + +foreach (item IN ITEMS basic COMPILE_LANGUAGE) + set(TARGET_NAME srcgenex_includes_${item}) + configure_file(srcgenex_includes.h.in "sf_includes_${item}/${TARGET_NAME}.h" @ONLY) + configure_file(srcgenex_includes.c.in ${TARGET_NAME}.c @ONLY) +endforeach() +add_executable(srcgenex_includes_basic "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c") +# first include directory is useless but ensure list aspect is tested +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_basic.c" + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/sf_includes_basic") +if (CMAKE_GENERATOR MATCHES "Makefiles|Ninja|Watcom WMake") + add_executable(srcgenex_includes_COMPILE_LANGUAGE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c") + # first include directory is useless but ensure list aspect is tested + set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/srcgenex_includes_COMPILE_LANGUAGE.c" + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}" $<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_BINARY_DIR}/sf_includes_COMPILE_LANGUAGE>) +endif() #----------------------------------------------------------------------------- # Cover test properties with generator expressions. diff --git a/Tests/GeneratorExpression/srcgenex_defs.c b/Tests/GeneratorExpression/srcgenex.c.in index 883e631..4a43bd1 100644 --- a/Tests/GeneratorExpression/srcgenex_defs.c +++ b/Tests/GeneratorExpression/srcgenex.c.in @@ -1,4 +1,4 @@ -int srcgenex_defs(void) +int @TARGET_NAME@(void) { return 0; } diff --git a/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c b/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c deleted file mode 100644 index 421b55b..0000000 --- a/Tests/GeneratorExpression/srcgenex_defs_COMPILE_LANGUAGE.c +++ /dev/null @@ -1,12 +0,0 @@ -int srcgenex_defs_COMPILE_LANGUAGE(void) -{ - return 0; -} - -int main(int argc, char* argv[]) -{ -#ifndef NAME -#error NAME not defined -#endif - return NAME(); -} diff --git a/Tests/GeneratorExpression/srcgenex_flags.c b/Tests/GeneratorExpression/srcgenex_flags.c deleted file mode 100644 index 3de2b12..0000000 --- a/Tests/GeneratorExpression/srcgenex_flags.c +++ /dev/null @@ -1,12 +0,0 @@ -int srcgenex_flags(void) -{ - return 0; -} - -int main(int argc, char* argv[]) -{ -#ifndef NAME -#error NAME not defined -#endif - return NAME(); -} diff --git a/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c b/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c deleted file mode 100644 index 4e80d6e..0000000 --- a/Tests/GeneratorExpression/srcgenex_flags_COMPILE_LANGUAGE.c +++ /dev/null @@ -1,12 +0,0 @@ -int srcgenex_flags_COMPILE_LANGUAGE(void) -{ - return 0; -} - -int main(int argc, char* argv[]) -{ -#ifndef NAME -#error NAME not defined -#endif - return NAME(); -} diff --git a/Tests/GeneratorExpression/srcgenex_includes.c.in b/Tests/GeneratorExpression/srcgenex_includes.c.in new file mode 100644 index 0000000..b48d7df --- /dev/null +++ b/Tests/GeneratorExpression/srcgenex_includes.c.in @@ -0,0 +1,12 @@ + +#include "@TARGET_NAME@.h" + +int @TARGET_NAME@(void) +{ + return 0; +} + +int main(int argc, char* argv[]) +{ + return @TARGET_NAME@(); +} diff --git a/Tests/GeneratorExpression/srcgenex_includes.h.in b/Tests/GeneratorExpression/srcgenex_includes.h.in new file mode 100644 index 0000000..2259ca6 --- /dev/null +++ b/Tests/GeneratorExpression/srcgenex_includes.h.in @@ -0,0 +1,7 @@ + +#if !defined @TARGET_NAME@_H +#define @TARGET_NAME@_H + +int @TARGET_NAME@(void); + +#endif diff --git a/Tests/JavaNativeHeaders/CMakeLists.txt b/Tests/JavaNativeHeaders/CMakeLists.txt new file mode 100644 index 0000000..7dc2679 --- /dev/null +++ b/Tests/JavaNativeHeaders/CMakeLists.txt @@ -0,0 +1,18 @@ +project(helloJavaNativeHeaders Java CXX) + +cmake_minimum_required (VERSION 2.6) +set(CMAKE_VERBOSE_MAKEFILE 1) + +find_package(Java COMPONENTS Development) +include (UseJava) + +# JNI support +find_package(JNI) + +add_jar(B1 D.java GENERATE_NATIVE_HEADERS D1-native) +add_jar(E1 E.java GENERATE_NATIVE_HEADERS E1-native) + +add_jar(hello4 HelloWorld3.java) + +add_library(D SHARED D.cpp E.cpp) +target_link_libraries (D PRIVATE D1-native E1-native) diff --git a/Tests/JavaNativeHeaders/D.cpp b/Tests/JavaNativeHeaders/D.cpp new file mode 100644 index 0000000..2a90a08 --- /dev/null +++ b/Tests/JavaNativeHeaders/D.cpp @@ -0,0 +1,10 @@ + +#include <jni.h> +#include <stdio.h> + +#include "D.h" + +JNIEXPORT void JNICALL Java_D_printName(JNIEnv*, jobject) +{ + printf("D\n"); +} diff --git a/Tests/JavaNativeHeaders/D.java b/Tests/JavaNativeHeaders/D.java new file mode 100644 index 0000000..449c0df --- /dev/null +++ b/Tests/JavaNativeHeaders/D.java @@ -0,0 +1,19 @@ +class D +{ + public D() + { + } + + public native void printName(); + + static { + try { + + System.loadLibrary("D"); + + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load.\n" + e); + System.exit(1); + } + } +} diff --git a/Tests/JavaNativeHeaders/E.cpp b/Tests/JavaNativeHeaders/E.cpp new file mode 100644 index 0000000..fb98946 --- /dev/null +++ b/Tests/JavaNativeHeaders/E.cpp @@ -0,0 +1,10 @@ + +#include <jni.h> +#include <stdio.h> + +#include "E.h" + +JNIEXPORT void JNICALL Java_E_printName(JNIEnv*, jobject) +{ + printf("E\n"); +} diff --git a/Tests/JavaNativeHeaders/E.java b/Tests/JavaNativeHeaders/E.java new file mode 100644 index 0000000..30fd95a --- /dev/null +++ b/Tests/JavaNativeHeaders/E.java @@ -0,0 +1,19 @@ +class E +{ + public E() + { + } + + public native void printName(); + + static { + try { + + System.loadLibrary("D"); + + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load.\n" + e); + System.exit(1); + } + } +} diff --git a/Tests/JavaNativeHeaders/HelloWorld3.java b/Tests/JavaNativeHeaders/HelloWorld3.java new file mode 100644 index 0000000..77f1fed --- /dev/null +++ b/Tests/JavaNativeHeaders/HelloWorld3.java @@ -0,0 +1,15 @@ +class HelloWorld3 +{ + public static void main(String args[]) + { + D d; + d = new D(); + d.printName(); + + E e; + e = new E(); + e.printName(); + + System.out.println("Hello World!"); + } +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e440b7f..d5bd297 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -176,6 +176,7 @@ add_RunCMake_test(CompileDefinitions) add_RunCMake_test(CompileFeatures) add_RunCMake_test(PolicyScope) add_RunCMake_test(WriteCompilerDetectionHeader) +add_RunCMake_test(SourceProperties) if(NOT WIN32) add_RunCMake_test(PositionIndependentCode) endif() diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index cf81f36..ae9a84c 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -85,6 +85,7 @@ macro_add_test_library(libshared) macro_add_test_library(libstatic) add_subdirectory(nodeprecated) +add_subdirectory(includeguard) if(NOT BORLAND) add_subdirectory(c_identifier) endif() diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 55625a8..18c3340 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -12,6 +12,8 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + run_cmake_command(GEH-incguard-macro-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_macro) + run_cmake_command(GEH-incguard-custom-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_custom) file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" failure_test_targets) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt new file mode 100644 index 0000000..514d27b --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt @@ -0,0 +1,19 @@ +set(libincludeguard_SRC libincludeguard.cpp) + +add_library(includeguard_macro ${libincludeguard_SRC}) +generate_export_header(includeguard_macro) + +set(EXPORT_HEADER includeguard_macro_export.h) +set(DEF_SYMBOL INCLUDEGUARD_MACRO_EXPORT_H) +set(NDEF_SYMBOL CUSTOM_GUARD) +configure_file(main.cpp.in main_macro.cpp) +add_executable(test_includeguard_macro ${CMAKE_CURRENT_BINARY_DIR}/main_macro.cpp) + +add_library(includeguard_custom ${libincludeguard_SRC}) +generate_export_header(includeguard_custom INCLUDE_GUARD_NAME CUSTOM_GUARD) + +set(EXPORT_HEADER includeguard_custom_export.h) +set(DEF_SYMBOL CUSTOM_GUARD) +set(NDEF_SYMBOL INCLUDEGUARD_CUSTOM_EXPORT_H) +configure_file(main.cpp.in main_custom.cpp) +add_executable(test_includeguard_custom ${CMAKE_CURRENT_BINARY_DIR}/main_custom.cpp) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in new file mode 100644 index 0000000..51bd5d9 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in @@ -0,0 +1,10 @@ +#include "@EXPORT_HEADER@" + +int main() +{ +#if defined(@DEF_SYMBOL@) && !defined(@NDEF_SYMBOL@) + return 0; +#else + return 1; +#endif +} diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h index e8af0a5..0b1dcba 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h index 053ad18..11f8042 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h index 808ff01..1481acd 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h index 4e675af..3ba2d2e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h index 4d5ed4e..3c7e093 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h index 84340e3..bf9163e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake new file mode 100644 index 0000000..dbdf7be --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake @@ -0,0 +1,4 @@ +include("${RunCMake_TEST_BINARY_DIR}/IncludeRegexSubdir/CMakeFiles/CMakeDirectoryInformation.cmake" OPTIONAL) +if(NOT CMAKE_C_INCLUDE_REGEX_SCAN STREQUAL "^custom_include_regex$") + set(RunCMake_TEST_FAILED "CMAKE_C_INCLUDE_REGEX_SCAN has unexpected value:\n \"${CMAKE_C_INCLUDE_REGEX_SCAN}\"") +endif() diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake new file mode 100644 index 0000000..a7a93a0 --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include_regular_expression("^custom_include_regex$") +add_subdirectory(IncludeRegexSubdir) diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt new file mode 100644 index 0000000..e712aea --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt @@ -0,0 +1 @@ +# We only need this directory to be processed. No targets needed. diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 869d11e..3b2b8f5 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -17,3 +17,4 @@ run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) run_cmake(CustomCommandDepfile-ERROR) +run_cmake(IncludeRegexSubdir) diff --git a/Tests/RunCMake/SourceProperties/CMakeLists.txt b/Tests/RunCMake/SourceProperties/CMakeLists.txt new file mode 100644 index 0000000..a17c8cd --- /dev/null +++ b/Tests/RunCMake/SourceProperties/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt new file mode 100644 index 0000000..cf146c2 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Found relative path while evaluating include directories of "empty.c": + + "relative" diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake new file mode 100644 index 0000000..08dffa8 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake @@ -0,0 +1,4 @@ + +set_property (SOURCE empty.c PROPERTY INCLUDE_DIRECTORIES "relative") + +add_library (somelib empty.c) diff --git a/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake new file mode 100644 index 0000000..0982153 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(RelativeIncludeDir) diff --git a/Tests/RunCMake/SourceProperties/empty.c b/Tests/RunCMake/SourceProperties/empty.c new file mode 100644 index 0000000..a9ec102 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/empty.c @@ -0,0 +1,5 @@ + +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt new file mode 100644 index 0000000..f9b8ee7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source INCLUDE_DIRECTORIES: + + \$<\$<CONFIG:Debug>:MYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake new file mode 100644 index 0000000..4476c39 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY INCLUDE_DIRECTORIES "$<$<CONFIG:Debug>:MYDEBUG>") diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt new file mode 100644 index 0000000..bfca020 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source COMPILE_OPTIONS: + + \$<\$<CONFIG:Debug>:-DMYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake new file mode 100644 index 0000000..f8e8030 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY COMPILE_OPTIONS $<$<CONFIG:Debug>:-DMYDEBUG>) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 1313cb5..64a07f0 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -19,7 +19,9 @@ if (NOT XCODE_VERSION VERSION_LESS 6) endif() run_cmake(PerConfigPerSourceFlags) +run_cmake(PerConfigPerSourceOptions) run_cmake(PerConfigPerSourceDefinitions) +run_cmake(PerConfigPerSourceIncludeDirs) # Use a single build tree for a few tests without cleaning. diff --git a/Tests/SourceFileIncludeDirProperty/CMakeLists.txt b/Tests/SourceFileIncludeDirProperty/CMakeLists.txt new file mode 100644 index 0000000..786d5b6 --- /dev/null +++ b/Tests/SourceFileIncludeDirProperty/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.0) + +project(SourceFileIncludeDirProperty C) + +# +# Check that source level include directory take +# precedence over target one + +add_executable(SourceFileIncludeDirProperty main.c) + +set_property (TARGET SourceFileIncludeDirProperty + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/target") + +set_property (SOURCE main.c + PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/source") diff --git a/Tests/SourceFileIncludeDirProperty/main.c b/Tests/SourceFileIncludeDirProperty/main.c new file mode 100644 index 0000000..36144ca --- /dev/null +++ b/Tests/SourceFileIncludeDirProperty/main.c @@ -0,0 +1,7 @@ + +#include "header.h" + +int main() +{ + return 0; +} diff --git a/Tests/SourceFileIncludeDirProperty/source/header.h b/Tests/SourceFileIncludeDirProperty/source/header.h new file mode 100644 index 0000000..0c6f241 --- /dev/null +++ b/Tests/SourceFileIncludeDirProperty/source/header.h @@ -0,0 +1,2 @@ + +/* used header file */ diff --git a/Tests/SourceFileIncludeDirProperty/target/header.h b/Tests/SourceFileIncludeDirProperty/target/header.h new file mode 100644 index 0000000..71c1521 --- /dev/null +++ b/Tests/SourceFileIncludeDirProperty/target/header.h @@ -0,0 +1,2 @@ + +#error "wrong header file" |