diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b86774..bf51c31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,9 @@ cmake_minimum_required(VERSION 2.8) if (${USE_GCC}) include(cmake/FindOmpGcc.cmake) +else() + set(CMAKE_C_COMPILER /usr/bin/gcc CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER /usr/bin/g++ CACHE STRING "C++ Compiler" FORCE) endif() get_filename_component(dirName ${CMAKE_CURRENT_SOURCE_DIR} NAME) diff --git a/cmake/FindOmpGcc.cmake b/cmake/FindOmpGcc.cmake index 4deddfa..39cfa7c 100644 --- a/cmake/FindOmpGcc.cmake +++ b/cmake/FindOmpGcc.cmake @@ -38,6 +38,8 @@ if(APPLE) # If len == 0, nothing to do here if(${len} EQUAL 0) message("No OMP-compliant compiler was found on this Mac.") + set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE STRING "C++ Compiler" FORCE) else() # Looping over each directory to extract major/intermediate versions foreach(dir ${compiler_dirs}) @@ -91,11 +93,12 @@ if(APPLE) endif() else() message("No OMP-compliant compiler was found on this Mac.") + set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE STRING "C++ Compiler" FORCE) endif() else() # Running on Linux. Will switch back to compiler in /usr/local/bin - message("Switching to /usr/local/gcc ") - set(CMAKE_C_COMPILER "/usr/local/bin/gcc" CACHE STRING "C Compiler" FORCE) - set(CMAKE_CXX_COMPILER "/usr/local/bin/g++" CACHE STRING "C++ Compiler" FORCE) + set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE STRING "C Compiler" FORCE) + set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE STRING "C++ Compiler" FORCE) endif()