pavelliavonau/cmakeconverter

Wrap compiler STREQUAL comparisons with check for existence of compiler first.

Closed this issue · 4 comments

bigla commented

Error Message:

CMake Error at CMakeLists.txt:66 (if):
  if given arguments:

    "CMAKE_Fortran_COMPILER_ID" "AND" "(" "STREQUAL" "Intel" ")"

  Unknown arguments specified


-- Configuring incomplete, errors occurred!

Since not every project has to enable Fortran compilation maybe check for existence of Fortran compiler before comparing.

Instead of

if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
    # remove default flags provided with CMake for ifort
    set(CMAKE_Fortran_FLAGS "")
    set(CMAKE_Fortran_FLAGS_DEBUG "")
    set(CMAKE_Fortran_FLAGS_RELEASE "")
endif()

maybe do:

if(CMAKE_Fortran_COMPILER_ID)
    if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
        # remove default flags provided with CMake for ifort
        set(CMAKE_Fortran_FLAGS "")
        set(CMAKE_Fortran_FLAGS_DEBUG "")
        set(CMAKE_Fortran_FLAGS_RELEASE "")
    endif()
endif()

Does project command of root file has Fortran language at languages list?

Provide full listing of root cmakelists.txt

bigla commented

You are right, I am wrong!

It does provide Fortran in the Language listing, because Fortran sources are used somewhere in the subprojects.

I just tried to compile all the CXX (ignoring Fortran sources) with just commenting out Fortran like this:

project(ROOT_FOLDER C CXX #[[Fortran]] )

in the Project languages list.

So I guess it is not intended to disable Languages this simple way?

Yes of course!
All additional comments are only your local problems.
Issue is invalid.