smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

CMake configuration error adding CUDA as a project language #265

Closed smanders closed 4 years ago

smanders commented 4 years ago

This leads to the following configuration error.

Found externpro: /opt/extern/externpro-19.06.1-gcc740-64-Linux
Found internpro: /opt/extern/internpro-19.10.1-gcc740-64-Linux
CMake Error at /opt/extern/externpro-19.06.1-gcc740-64-Linux/share/cmake/xpfunmac.cmake:1681 (elseif):
  given arguments:

    "CMAKE_COMPILER_IS_GNUCC" "OR" "CMAKE_COMPILER_IS_GNUCXX" "OR" "MATCHES" "Clang" "OR" "GNU" "MATCHES" "Clang"

  Unknown arguments specified
Call Stack (most recent call first):
  /opt/extern/externpro-19.06.1-gcc740-64-Linux/share/cmake/xpfunmac.cmake:1730 (xpToggleDebugInfo)
  /opt/extern/externpro-19.06.1-gcc740-64-Linux/share/cmake/xpfunmac.cmake:1772 (xpDebugInfoOption)
  /opt/extern/externpro-19.06.1-gcc740-64-Linux/share/cmake/xpfunmac.cmake:2063 (xpCommonFlags)
  Shared/make/toplevel.cmake:14 (xpSetFlags)
  CMakeLists.txt:8 (include)

Configuring incomplete, errors occurred!
smanders commented 4 years ago

it's failing on the following line https://github.com/smanders/externpro/blob/19.06.1/modules/xpfunmac.cmake#L1681-L1682

  elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR
         ${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")

because CMAKE_C_COMPILER_ID is empty

and CMAKE_C_COMPILER_ID is empty because the project() call specifies LANGUAGES now, but didn't include C

the fix is to change the project call to

project(SyersPlugin LANGUAGES CUDA CXX C VERSION 0.9.0.52)