From 55c2e1845d0701b266b0f6b8b00bea3ee9cd4d34 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 2 Aug 2017 01:17:10 +0000 Subject: [PATCH] Merged from WSJT-X v1.8 branch: ------------------------------------------------------------------------ r7977 | bsomervi | 2017-08-02 01:19:07 +0100 (Wed, 02 Aug 2017) | 1 line Adjust the CMake script to allow for a rewritten FindOpenMP script in CMake v3.9 ------------------------------------------------------------------------ r7978 | bsomervi | 2017-08-02 02:14:52 +0100 (Wed, 02 Aug 2017) | 1 line Fix a typo in r7977 ------------------------------------------------------------------------ git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7979 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5bf289e9..dfea6bc9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -898,8 +898,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_FLAGS) + 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") @@ -1107,9 +1109,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) @@ -1249,10 +1256,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) @@ -1295,9 +1307,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)