summaryrefslogtreecommitdiffstats
path: root/Tests/SourceFileProperty
diff options
context:
space:
mode:
authorTushar Maheshwari <tushar27192@gmail.com>2019-08-27 06:49:43 (GMT)
committerTushar Maheshwari <tushar27192@gmail.com>2019-08-27 16:11:12 (GMT)
commita40744c81a8d6dad994def5a63103fc229a75afc (patch)
treeb6335dd49ba8acdc7aa2f246e89c89e1b8015578 /Tests/SourceFileProperty
parent8cb3cffa42e11c2508ed8db703f2f9a1a73fbbb9 (diff)
downloadCMake-a40744c81a8d6dad994def5a63103fc229a75afc.zip
CMake-a40744c81a8d6dad994def5a63103fc229a75afc.tar.gz
CMake-a40744c81a8d6dad994def5a63103fc229a75afc.tar.bz2
cmSourceFile: Move LANGUAGE to GetPropertyForUser
- Remove the special case from cmGetSourceFilePropertyCommand Tests: check LANGUAGE for source file - use target_sources to add file - use get_property to read property value
Diffstat (limited to 'Tests/SourceFileProperty')
-rw-r--r--Tests/SourceFileProperty/CMakeLists.txt17
1 files changed, 10 insertions, 7 deletions
diff --git a/Tests/SourceFileProperty/CMakeLists.txt b/Tests/SourceFileProperty/CMakeLists.txt
index 1b6506d..5dbc34f 100644
--- a/Tests/SourceFileProperty/CMakeLists.txt
+++ b/Tests/SourceFileProperty/CMakeLists.txt
@@ -1,19 +1,22 @@
-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_property(LANG SOURCE ICaseTest.c PROPERTY LANGUAGE)
+if (NOT "${LANG}" STREQUAL "C")
+ message(FATAL_ERROR "Bad language for file ICaseTest.c")
+endif ()