summaryrefslogtreecommitdiffstats
path: root/Tests/CxxOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-06-11 18:03:28 (GMT)
committerBrad King <brad.king@kitware.com>2020-06-11 18:15:18 (GMT)
commit5c04e77e0792c0a704ec4d7c2bb228750d37d060 (patch)
tree080c160f00b7e96355e3174d9737fe387ac9bd42 /Tests/CxxOnly
parent01fb8d7993f2ebcc47ce8ecab1aa5144a4ca4b80 (diff)
downloadCMake-5c04e77e0792c0a704ec4d7c2bb228750d37d060.zip
CMake-5c04e77e0792c0a704ec4d7c2bb228750d37d060.tar.gz
CMake-5c04e77e0792c0a704ec4d7c2bb228750d37d060.tar.bz2
VS: Restore compilation of '.C' sources as C++
Refactoring in commit 3b547e2e4b (VS: Simplify logic adding source file C/C++ language flag to MSVC, 2020-05-15, v3.18.0-rc1~139^2~1) failed to account for MSVC's treatment of `.C` extensions as C. Add this special case to the logic to restore use of `-TP` for `.C` extensions. Fixes: #20822
Diffstat (limited to 'Tests/CxxOnly')
-rw-r--r--Tests/CxxOnly/CMakeLists.txt2
-rw-r--r--Tests/CxxOnly/cxxonly.cxx2
-rw-r--r--Tests/CxxOnly/test.C1
3 files changed, 4 insertions, 1 deletions
diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt
index e62f3c7..8207dd1 100644
--- a/Tests/CxxOnly/CMakeLists.txt
+++ b/Tests/CxxOnly/CMakeLists.txt
@@ -5,7 +5,7 @@ set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
if(WIN32)
set(EXTRA_SRCS test.CPP)
endif()
-add_library(testcxx1.my STATIC libcxx1.cxx ${EXTRA_SRCS})
+add_library(testcxx1.my STATIC libcxx1.cxx test.C ${EXTRA_SRCS})
add_library(testcxx2 SHARED libcxx2.cxx)
add_executable (CxxOnly cxxonly.cxx)
target_link_libraries(CxxOnly testcxx1.my testcxx2)
diff --git a/Tests/CxxOnly/cxxonly.cxx b/Tests/CxxOnly/cxxonly.cxx
index 0911a07..8bd1637 100644
--- a/Tests/CxxOnly/cxxonly.cxx
+++ b/Tests/CxxOnly/cxxonly.cxx
@@ -1,5 +1,6 @@
#include "libcxx1.h"
#include "libcxx2.h"
+extern int testC;
#ifdef _MSC_VER
extern int testCPP;
#endif
@@ -8,6 +9,7 @@ extern int testCPP;
int main()
{
+ testC = 1;
#ifdef _MSC_VER
testCPP = 1;
#endif
diff --git a/Tests/CxxOnly/test.C b/Tests/CxxOnly/test.C
new file mode 100644
index 0000000..e87e6c0
--- /dev/null
+++ b/Tests/CxxOnly/test.C
@@ -0,0 +1 @@
+int testC;