Merge pull request #156 from piyushrpt/cmake

Fixing linking order and flags for mdx
LT1AB
Ryan Burns 2020-07-15 22:06:10 -07:00 committed by GitHub
commit 1f947b4e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -5,9 +5,6 @@ set(components
find_package(X11 COMPONENTS ${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) if(X11_FOUND)
# make X11 look like a regular find_package component # make X11 look like a regular find_package component

View File

@ -3,22 +3,30 @@ if(TARGET Motif::Motif
AND TARGET X11::Xau AND TARGET X11::Xau
AND TARGET X11::Xt 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 add_executable(mdx
src/graphx_mdx.c src/graphx_mdx.c
src/rdf_reader_subs.f src/rdf_reader_subs.f
src/mdx_main.F src/mdx_main.F
src/mdx.F src/mdx_subs.F
) )
target_compile_definitions(mdx PRIVATE SUN IO64) target_compile_definitions(mdx PRIVATE SUN IO64)
if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") target_include_directories(mdx PUBLIC
target_compile_definitions(mdx PRIVATE GFORTRAN) ${X11_Xt_INCLUDE_PATH}
endif() ${X11_X11_INCLUDE_PATH}
${MOTIF_INCLUDE_DIR})
target_link_libraries(mdx PUBLIC target_link_libraries(mdx PUBLIC
Motif::Motif ${X11_X11_LIB}
X11::X11 ${MOTIF_LIBRARIES}
X11::Xau ${X11_Xt_LIB}
X11::Xt
) )
install(TARGETS mdx install(TARGETS mdx
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
) )