diff options
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/Objective-C/cxx-file-extension-test/main.m | 8 |
4 files changed, 29 insertions, 1 deletions
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index ef65021..efb8abf 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -45,7 +45,7 @@ set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) -foreach (lang OBJC OBJCXX) +foreach (lang C OBJC OBJCXX) if (CMAKE_${lang}_COMPILER_ID_RUN) foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 32b580b..b29638b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2353,6 +2353,18 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test") + add_test(Objective-C.cxx-file-extension-test ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Objective-C/cxx-file-extension-test" + "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test" + --build-two-config + ${build_generator_args} + --build-project cxx-file-extension-test + --build-options ${build_options} + --test-command cxx-file-extension-test + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test") + add_test(Objective-C.objc-file-extension-test ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Objective-C/objc-file-extension-test" diff --git a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt new file mode 100644 index 0000000..eb065e4 --- /dev/null +++ b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(cxx-file-extension-test) + +string(APPEND CMAKE_CXX_FLAGS " -std=c++11") +set(CMAKE_CXX_STANDARD 14) + +add_executable(cxx-file-extension-test main.m) diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/Objective-C/cxx-file-extension-test/main.m new file mode 100644 index 0000000..1c159a9 --- /dev/null +++ b/Tests/Objective-C/cxx-file-extension-test/main.m @@ -0,0 +1,8 @@ +#ifndef __OBJC__ +# error "Compiler cannot compile Objective-C" +#endif + +int main() +{ + return 0; +} |