Fix for CMake < 3.12.0

As several current LTS distributions currently ship with CMake
< 3.12.0, add a work-around for CMake Issue 16967.

Otherwise we get:
CMake Error at
/usr/share/cmake-3.7/Modules/CheckCXXSourceCompiles.cmake:64 (try_compile):
   Unknown extension ".cxx" for file

     /tmp/rtl-sdr/build/CMakeFiles/CMakeTmp/src.cxx

   try_compile() works only for enabled languages.  Currently these are:

     C
This commit is contained in:
Steve Markgraf 2020-03-02 21:11:40 +01:00
parent 3d7cdc5221
commit d6ca2b0fc5
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,13 @@
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.7.2)
project(rtlsdr C)
# workaround for https://gitlab.kitware.com/cmake/cmake/issues/16967
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
project(rtlsdr)
else()
project(rtlsdr C)
endif()
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)