From 4449e78b799440cd55f831cd63d2b3b53e67994f Mon Sep 17 00:00:00 2001 From: piyushrpt Date: Sat, 4 Jul 2020 10:20:00 -0700 Subject: [PATCH] fixing linking order and flags for mdx Not using interfaces for motif --- .cmake/TargetX11.cmake | 3 --- contrib/mdx/CMakeLists.txt | 24 ++++++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.cmake/TargetX11.cmake b/.cmake/TargetX11.cmake index 805ae0d..50533df 100644 --- a/.cmake/TargetX11.cmake +++ b/.cmake/TargetX11.cmake @@ -5,9 +5,6 @@ set(components find_package(X11 COMPONENTS ${components}) -# The X11::{component} targets only exist for CMake ≥ 3.14, -# so we create them here for backwards compatibility. - if(X11_FOUND) # make X11 look like a regular find_package component diff --git a/contrib/mdx/CMakeLists.txt b/contrib/mdx/CMakeLists.txt index efacb3c..a4673e0 100644 --- a/contrib/mdx/CMakeLists.txt +++ b/contrib/mdx/CMakeLists.txt @@ -3,22 +3,30 @@ if(TARGET Motif::Motif AND TARGET X11::Xau AND TARGET X11::Xt ) + + #Only for this folder - ensure openmp is not used for compiling + #Modifying flags here have directory scope + if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") + string(REPLACE "-fopenmp" " " CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + endif() + add_executable(mdx src/graphx_mdx.c src/rdf_reader_subs.f src/mdx_main.F - src/mdx.F + src/mdx_subs.F ) target_compile_definitions(mdx PRIVATE SUN IO64) - if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") - target_compile_definitions(mdx PRIVATE GFORTRAN) - endif() + target_include_directories(mdx PUBLIC + ${X11_Xt_INCLUDE_PATH} + ${X11_X11_INCLUDE_PATH} + ${MOTIF_INCLUDE_DIR}) target_link_libraries(mdx PUBLIC - Motif::Motif - X11::X11 - X11::Xau - X11::Xt + ${X11_X11_LIB} + ${MOTIF_LIBRARIES} + ${X11_Xt_LIB} ) + install(TARGETS mdx RUNTIME DESTINATION bin )