diff options
author | Brad King <brad.king@kitware.com> | 2014-12-03 15:02:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-12-03 15:02:05 (GMT) |
commit | d91feda4136b8fb9bc3002b38ba8c08fca9cd62c (patch) | |
tree | 90094402755bdc7e92a6daeb6ddec063a199536e /Tests | |
parent | 9843dfab4486f76cab567862e504a71d1ecc58a5 (diff) | |
parent | b7d760aea20f70b221fcba7ecb2c7edf7751ffc2 (diff) | |
download | CMake-d91feda4136b8fb9bc3002b38ba8c08fca9cd62c.zip CMake-d91feda4136b8fb9bc3002b38ba8c08fca9cd62c.tar.gz CMake-d91feda4136b8fb9bc3002b38ba8c08fca9cd62c.tar.bz2 |
Merge topic 'icase-source-file-prop'
b7d760ae test: test source file properties with case-insensitivity
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/SourceFileProperty/CMakeLists.txt | 19 | ||||
-rw-r--r-- | Tests/SourceFileProperty/ICaseTest.c | 7 | ||||
-rw-r--r-- | Tests/SourceFileProperty/main.c | 13 |
4 files changed, 40 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c9d9568..fda9359 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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) diff --git a/Tests/SourceFileProperty/CMakeLists.txt b/Tests/SourceFileProperty/CMakeLists.txt new file mode 100644 index 0000000..1b6506d --- /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 0000000..454c721 --- /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 0000000..b853408 --- /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 +} |