From 41ba3e28e6840fd560a537d400146d2cde67a239 Mon Sep 17 00:00:00 2001 From: Tushar Maheshwari Date: Tue, 27 Aug 2019 22:28:34 +0530 Subject: Tests: Collect SourceFileProperty tests - Move the related test from COnly to SourceFileProperty - Cover `get_source_file_property` and `get_property(... SOURCE ...)` --- Tests/COnly/CMakeLists.txt | 6 ------ Tests/SourceFileProperty/CMakeLists.txt | 9 +++++++-- 2 files changed, 7 insertions(+), 8 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 5dbc34f..5e55f7b 100644 --- a/Tests/SourceFileProperty/CMakeLists.txt +++ b/Tests/SourceFileProperty/CMakeLists.txt @@ -16,7 +16,12 @@ endif () add_executable(SourceFileProperty main.c) target_sources(SourceFileProperty PRIVATE ICaseTest.c) -get_property(LANG SOURCE ICaseTest.c PROPERTY LANGUAGE) -if (NOT "${LANG}" STREQUAL "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 () -- cgit v0.12