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
8 COMPILE_DEFINITIONS NEEDED_TO_WORK)
10 # Work on case-sensitive file systems as well.
11 set_source_files_properties(main.c
13 COMPILE_DEFINITIONS NO_NEED_TO_CALL)
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")
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")