Selaa lähdekoodia

Let CMake recognize .CPP .CXX and .C++ as c++ files.

Bill Hoffman 15 vuotta sitten
vanhempi
sitoutus
ced61f5722

+ 2 - 2
Modules/CMakeCXXCompiler.cmake.in

@@ -21,8 +21,8 @@ IF(CMAKE_COMPILER_IS_MINGW)
   SET(MINGW 1)
 ENDIF(CMAKE_COMPILER_IS_MINGW)
 SET(CMAKE_CXX_COMPILER_ID_RUN 1)
-SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;H;o;O;obj;OBJ;def;DEF;rc;RC)
-SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm)
+SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
+SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;C++;CC;CPP;CXX)
 SET(CMAKE_CXX_LINKER_PREFERENCE 30)
 SET(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
 

+ 1 - 1
Tests/CxxOnly/CMakeLists.txt

@@ -2,7 +2,7 @@
 project (CxxOnly CXX)
 
 set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
-add_library(testcxx1 STATIC libcxx1.cxx)
+add_library(testcxx1 STATIC libcxx1.cxx test.CPP test.CXX test.C++)
 add_library(testcxx2 SHARED libcxx2.cxx)
 add_executable (CxxOnly cxxonly.cxx)
 target_link_libraries(CxxOnly testcxx1 testcxx2)

+ 4 - 0
Tests/CxxOnly/cxxonly.cxx

@@ -1,10 +1,14 @@
 #include "libcxx1.h"
 #include "libcxx2.h"
+extern int testCPP;
+extern int testCXX;
+extern int testCplusplus;
 
 #include <stdio.h>
 
 int main ()
 {
+  testCPP = testCXX= testCplusplus = 1;
   if ( LibCxx1Class::Method() != 2.0 )
     {
     printf("Problem with libcxx1\n");

+ 1 - 0
Tests/CxxOnly/test.C++

@@ -0,0 +1 @@
+int testCplusplus;

+ 1 - 0
Tests/CxxOnly/test.CPP

@@ -0,0 +1 @@
+int testCPP;

+ 1 - 0
Tests/CxxOnly/test.CXX

@@ -0,0 +1 @@
+int testCXX;