diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-22 16:44:59 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-03-09 19:49:17 (GMT) |
commit | 9e1689413fd1e54e8056b7d369cd508636987072 (patch) | |
tree | 1c75b3c8b78789e99f23abd09e6c59c1aa86c4e0 /Tests/RunCMake/File_Generate | |
parent | b734fa44719a780683e2eb0dfaabd38d64daa3f6 (diff) | |
download | CMake-9e1689413fd1e54e8056b7d369cd508636987072.zip CMake-9e1689413fd1e54e8056b7d369cd508636987072.tar.gz CMake-9e1689413fd1e54e8056b7d369cd508636987072.tar.bz2 |
File(GENERATE): Process genex evaluation files for each language.
Diffstat (limited to 'Tests/RunCMake/File_Generate')
5 files changed, 32 insertions, 1 deletions
diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 0000000..e2b081d --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$<COMPILE_LANGUAGE> +) + +file(GENERATE + OUTPUT opts-$<COMPILE_LANGUAGE>.txt + CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" +) diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de..0abb7df 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5..db344ef 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 0000000..563eef0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} |