Commit b7d760ae authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King

test: test source file properties with case-insensitivity

Some filesystems are case insensitive, so when setting properties on the
files, this should be respected (modulo a policy decision).
parent 3350e4d2
......@@ -291,6 +291,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(ConfigSources ConfigSources)
endif()
ADD_TEST_MACRO(SourcesProperty SourcesProperty)
ADD_TEST_MACRO(SourceFileProperty SourceFileProperty)
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
set(runCxxDialectTest 1)
......
cmake_minimum_required(VERSION 3.0)
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)
else ()
# Work on case-sensitive file systems as well.
set_source_files_properties(main.c
PROPERTIES
COMPILE_FLAGS -DNO_NEED_TO_CALL)
endif ()
list(APPEND sources ICaseTest.c)
add_executable(SourceFileProperty main.c ${sources})
#ifdef NEEDED_TO_WORK
int icasetest()
{
return 0;
}
#endif
#ifndef NO_NEED_TO_CALL
extern int icasetest();
#endif
int main(int argc, char** argv)
{
#ifdef NO_NEED_TO_CALL
return 0;
#else
return icasetest();
#endif
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment