From b7d760aea20f70b221fcba7ecb2c7edf7751ffc2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Nov 2014 13:21:55 -0500 Subject: 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). --- Tests/SourceFileProperty/CMakeLists.txt | 19 +++++++++++++++++++ Tests/SourceFileProperty/ICaseTest.c | 7 +++++++ Tests/SourceFileProperty/main.c | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 Tests/SourceFileProperty/CMakeLists.txt create mode 100644 Tests/SourceFileProperty/ICaseTest.c create mode 100644 Tests/SourceFileProperty/main.c (limited to 'Tests/SourceFileProperty') diff --git a/Tests/SourceFileProperty/CMakeLists.txt b/Tests/SourceFileProperty/CMakeLists.txt new file mode 100644 index 0000000000..1b6506da57 --- /dev/null +++ b/Tests/SourceFileProperty/CMakeLists.txt @@ -0,0 +1,19 @@ +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}) diff --git a/Tests/SourceFileProperty/ICaseTest.c b/Tests/SourceFileProperty/ICaseTest.c new file mode 100644 index 0000000000..454c721fec --- /dev/null +++ b/Tests/SourceFileProperty/ICaseTest.c @@ -0,0 +1,7 @@ + +#ifdef NEEDED_TO_WORK +int icasetest() +{ + return 0; +} +#endif diff --git a/Tests/SourceFileProperty/main.c b/Tests/SourceFileProperty/main.c new file mode 100644 index 0000000000..b853408a22 --- /dev/null +++ b/Tests/SourceFileProperty/main.c @@ -0,0 +1,13 @@ + +#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 +} -- cgit v1.2.1