If OpenMP flags were set because find_package(OpenMP) could
find something but GMX_OPENMP was false (either set by user
or because find_package(OpenMP) was only partial succesful)
then compiler or linker flags was set which were not needed.
This could cause undefined OpenMP linker errors with
GMX_OPENMP=no.
Fixes part of #1021
Change-Id: I9b66a8c89a84374081886cd2eeb46c87664c1e39
CACHE STRING "Linker flags for creating shared libraries" FORCE)
endif (NOT DEFINED GROMACS_C_FLAGS_SET)
+if(NOT GMX_OPENMP)
+ #Unset all OpenMP flags in case OpenMP was disabled either by the user
+ #or because it was only partially detected (e.g. only for C but not C++ compiler)
+ unset(OpenMP_C_FLAGS CACHE)
+ unset(OpenMP_CXX_FLAGS CACHE)
+ unset(OpenMP_LINKER_FLAGS CACHE)
+ unset(OpenMP_SHARED_LINKER_FLAGS)
+endif()
######################################
# Output compiler and CFLAGS used
######################################