Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check presence of CC/CXX/FC compilers #32

Merged
merged 2 commits into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ elseif(WI4MPI_COMPILER MATCHES FUJITSU)
set(MPI_Fortran_COMPILER "mpifrt" CACHE STRING "" FORCE)
endif()

# Check presence of CC, CXX and FC compilers
# If nothing is found, the result will be <VAR>-NOTFOUND
find_program(CC_PATH "${CC}")
if("${CC_PATH}" MATCHES "CC_PATH-NOTFOUND")
message(FATAL_ERROR "C compiler not found in PATH!
Current value of CC is: ${CC}")
endif()
find_program(CXX_PATH "${CXX}")
if("${CXX_PATH}" MATCHES "CXX_PATH-NOTFOUND")
message(FATAL_ERROR "C++ compiler not found in PATH!
Current value of CXX is: ${CXX}")
endif()
find_program(FC_PATH "${FC}")
if("${FC_PATH}" MATCHES "FC_PATH-NOTFOUND")
message(FATAL_ERROR "Fortran compiler not found in PATH!
Current value of FC is: ${FC}")
endif()
enable_language(C CXX Fortran)

#Define the compiling option according to the choosen release
Expand All @@ -125,8 +142,14 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon")

find_package(Threads)
if(NOT CMAKE_THREAD_LIBS_INIT)
message(FATAL_ERROR "Be sure to have Pthread available on you system")
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
if(NOT CMAKE_THREAD_LIBS_INIT)
message(FATAL_ERROR "Be sure to have Pthread available on your system")
endif()
else()
if(NOT Threads_FOUND)
message(FATAL_ERROR "Be sure to have Pthread available on your system")
endif()
endif()

#Setting wi4mpi.cfg
Expand Down