diff options
author | Brad King <brad.king@kitware.com> | 2019-08-28 15:51:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-28 15:52:04 (GMT) |
commit | ffa1fa20e6ef3e78aad2dca75658232593509519 (patch) | |
tree | cdb7904d053fae028fc1da9c6c14d6d7370c4fa6 /Tests | |
parent | 606df71e48bf3594a7f79d68d990f401af9e45ea (diff) | |
parent | 41ba3e28e6840fd560a537d400146d2cde67a239 (diff) | |
download | CMake-ffa1fa20e6ef3e78aad2dca75658232593509519.zip CMake-ffa1fa20e6ef3e78aad2dca75658232593509519.tar.gz CMake-ffa1fa20e6ef3e78aad2dca75658232593509519.tar.bz2 |
Merge topic 'sf-LANGUAGE-prop'
41ba3e28e6 Tests: Collect SourceFileProperty tests
a40744c81a cmSourceFile: Move LANGUAGE to GetPropertyForUser
8cb3cffa42 cmSourceFile: Rename non-const GetLanguage
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3744
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/COnly/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/SourceFileProperty/CMakeLists.txt | 22 |
2 files changed, 15 insertions, 13 deletions
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 3037f13..20615fe 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -13,11 +13,5 @@ if(MSVC_VERSION AND NOT CMAKE_C_COMPILER_ID STREQUAL Clang OR "x${CMAKE_C_COMPIL endif() string(ASCII 35 32 67 77 97 107 101 ASCII_STRING) message(STATUS "String: ${ASCII_STRING}") -get_source_file_property(LANG conly.c LANGUAGE) -if("${LANG}" STREQUAL "C") - message("Language is C") -else() - message(FATAL_ERROR "Bad language for file conly.c") -endif() add_library(testCModule MODULE testCModule.c) diff --git a/Tests/SourceFileProperty/CMakeLists.txt b/Tests/SourceFileProperty/CMakeLists.txt index 1b6506d..5e55f7b 100644 --- a/Tests/SourceFileProperty/CMakeLists.txt +++ b/Tests/SourceFileProperty/CMakeLists.txt @@ -1,19 +1,27 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.1) project(SourceFileProperty C) -set(sources) - if (EXISTS icasetest.c) # If a file exists by this name, use it. set_source_files_properties(icasetest.c PROPERTIES - COMPILE_FLAGS -DNEEDED_TO_WORK) + COMPILE_DEFINITIONS NEEDED_TO_WORK) else () # Work on case-sensitive file systems as well. set_source_files_properties(main.c PROPERTIES - COMPILE_FLAGS -DNO_NEED_TO_CALL) + COMPILE_DEFINITIONS NO_NEED_TO_CALL) endif () -list(APPEND sources ICaseTest.c) -add_executable(SourceFileProperty main.c ${sources}) +add_executable(SourceFileProperty main.c) +target_sources(SourceFileProperty PRIVATE ICaseTest.c) + +get_source_file_property(LANG_MAIN main.c LANGUAGE) +if(NOT "${LANG_MAIN}" STREQUAL "C") + message(FATAL_ERROR "Bad language for file main.c") +endif() + +get_property(LANG_TEST SOURCE ICaseTest.c PROPERTY LANGUAGE) +if (NOT "${LANG_TEST}" STREQUAL "C") + message(FATAL_ERROR "Bad language for file ICaseTest.c") +endif () |