CMakeLists.txt: Don't require a C++ compiler 1317/head
authorPeter Korsgaard <peter@korsgaard.com>
Mon, 4 Jan 2021 08:05:42 +0000 (09:05 +0100)
committerFabrice Fontaine <fontaine.fabrice@gmail.com>
Mon, 4 Jan 2021 08:14:20 +0000 (09:14 +0100)
By default, CMake assumes that the project is using both C and C++.  By
explicitly passing 'C' as argument of the project() macro, we tell CMake
that only C is used, which prevents CMake from erroring out if a C++
compiler doesn't exist.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
[Retrieved (and slightly updated by adding enable_language(CXX) if
WITH_ASTYLE is set) from:
https://git.buildroot.net/buildroot/tree/package/openjpeg/0003-CMakeLists.txt-Don-t-require-a-C-compiler.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
CMakeLists.txt
thirdparty/CMakeLists.txt

index 5a4107837791881ab82449403fb7622386115c52..136d72878cd78ec15e906387ec724895bd69e59c 100644 (file)
@@ -24,7 +24,7 @@ endif()
 #string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
 set(OPENJPEG_LIBRARY_NAME openjp2)
 
-project(${OPENJPEG_NAMESPACE})
+project(${OPENJPEG_NAMESPACE} C)
 
 # Do full dependency headers.
 include_regular_expression("^.*$")
index b0b229c8dde93f0ab43f2f9dd4c0bdee9aeb4d08..ebdcd9d4d09cb73dbbddcf708bd7ffbee8b7830a 100644 (file)
@@ -120,5 +120,6 @@ endif(BUILD_THIRDPARTY)
 
 #------------
 IF (WITH_ASTYLE)
+  enable_language(CXX)
   ADD_SUBDIRECTORY(astyle)
 ENDIF(WITH_ASTYLE)