CMake Nightly Date Stamp
[kiteware-cmake.git] / Tests / SourceFileProperty / CMakeLists.txt
blobd980e04b9e13fee816294c0e1a76861ebd63985e
1 cmake_minimum_required(VERSION 3.10)
2 project(SourceFileProperty C)
4 if (EXISTS icasetest.c)
5   # If a file exists by this name, use it.
6   set_source_files_properties(icasetest.c
7     PROPERTIES
8       COMPILE_DEFINITIONS NEEDED_TO_WORK)
9 else ()
10   # Work on case-sensitive file systems as well.
11   set_source_files_properties(main.c
12     PROPERTIES
13       COMPILE_DEFINITIONS NO_NEED_TO_CALL)
14 endif ()
16 add_executable(SourceFileProperty main.c)
17 target_sources(SourceFileProperty PRIVATE ICaseTest.c)
19 get_source_file_property(LANG_MAIN main.c LANGUAGE)
20 if(NOT "${LANG_MAIN}" STREQUAL "C")
21   message(FATAL_ERROR "Bad language for file main.c")
22 endif()
24 get_property(LANG_TEST SOURCE ICaseTest.c PROPERTY LANGUAGE)
25 if (NOT "${LANG_TEST}" STREQUAL "C")
26   message(FATAL_ERROR "Bad language for file ICaseTest.c")
27 endif ()