From 4d78c87ce09125c6a9ab0aff5abe05a6fce9bc02 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 2 Aug 2017 00:19:07 +0000 Subject: [PATCH] Adjust the CMake script to allow for a rewritten FindOpenMP script in CMake v3.9 git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.8@7977 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc71750bc..aa2118d35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -893,8 +893,10 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fexceptions -frtti") if (NOT APPLE) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pragmas") if (${OPENMP_FOUND}) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + if (OpenMP_C_CLAGS}) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + endif () endif () set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fdata-sections -ffunction-sections") set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -fdata-sections -ffunction-sections") @@ -1102,9 +1104,14 @@ target_link_libraries (wsjt_fort ${FFTW3_LIBRARIES}) if (${OPENMP_FOUND} OR APPLE) add_library (wsjt_fort_omp STATIC ${wsjt_FSRCS}) target_link_libraries (wsjt_fort_omp ${FFTW3_LIBRARIES}) + if (OpenMP_C_FLAGS) + set_target_properties (wsjt_fort_omp + PROPERTIES + COMPILE_FLAGS "${OpenMP_C_FLAGS}" + ) + endif () set_target_properties (wsjt_fort_omp PROPERTIES - COMPILE_FLAGS "${OpenMP_C_FLAGS}" Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran_modules_omp ) file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran_modules_omp) @@ -1244,10 +1251,15 @@ if (${OPENMP_FOUND} OR APPLE) $<$:-fopenmp> # assumes GNU style Fortran compiler ) else (APPLE) + if (OpenMP_C_FLAGS) + set_target_properties (jt9 + PROPERTIES + COMPILE_FLAGS "${OpenMP_C_FLAGS}" + LINK_FLAGS "${OpenMP_C_FLAGS}" + ) + endif () set_target_properties (jt9 PROPERTIES - COMPILE_FLAGS "${OpenMP_C_FLAGS}" - LINK_FLAGS "${OpenMP_C_FLAGS}" Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran_modules_omp ) endif (APPLE) @@ -1290,9 +1302,13 @@ if (APPLE) target_link_libraries (wsjtx wsjt_fort wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES}) else () target_link_libraries (wsjtx wsjt_fort_omp wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES}) + if (OpenMP_C_FLAGS) + set_target_properties (wsjtx PROPERTIES + COMPILE_FLAGS "${OpenMP_C_FLAGS}" + LINK_FLAGS "${OpenMP_C_FLAGS}" + ) + endif () set_target_properties (wsjtx PROPERTIES - COMPILE_FLAGS "${OpenMP_C_FLAGS}" - LINK_FLAGS "${OpenMP_C_FLAGS}" Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/fortran_modules_omp ) if (WIN32)