Commit f32b79d3 authored by Sebastian Müller's avatar Sebastian Müller 🐈
Browse files

Cmake: use target_link_options with cmake>=3.13; minor cleanup

parent fe671b97
......@@ -24,16 +24,20 @@ cpp_definitions("-DpgiFortran" "CMAKE_pgiFortran" "OFF" "Code exchange for pgi c
cpp_definitions("-DMPR_STANDALONE" "CMAKE_MPR_STANDALONE" "OFF" "If set to ON, only MPR is compiled")
cpp_definitions("-DABSOFT" "CMAKE_ABSOFT" "OFF" "Documentation to be added. If you you are developer, you might edit this string in CMakeLists.txt")
# target_link_options would be better but is only available for cmake >=3.13
# target_link_options(${LIB_NAME} PUBLIC
# ${NETCDF_LDFLAGS_OTHER}
# ${MPI_Fortran_LINK_FLAGS}
# ${OpenMP_Fortran_FLAGS}
# ${LAPACK_LINKER_FLAGS}
# )
set_property(TARGET ${LIB_NAME} PROPERTY LINK_FLAGS
"${NETCDF_LDFLAGS_OTHER} ${MPI_Fortran_LINK_FLAGS} ${OpenMP_Fortran_FLAGS} ${LAPACK_LINKER_FLAGS}"
)
# all compile and link options are PUBLIC in order to be forwared to 'mhm' exe
# target_link_options only available in cmake 3.13
if(CMAKE_VERSION VERSION_LESS 3.13)
set_property(TARGET ${LIB_NAME} PROPERTY LINK_FLAGS
"${NETCDF_LDFLAGS_OTHER} ${MPI_Fortran_LINK_FLAGS} ${OpenMP_Fortran_FLAGS} ${LAPACK_LINKER_FLAGS}"
)
else()
target_link_options(${LIB_NAME} PUBLIC
${NETCDF_LDFLAGS_OTHER}
${MPI_Fortran_LINK_FLAGS}
${OpenMP_Fortran_FLAGS}
${LAPACK_LINKER_FLAGS}
)
endif()
target_compile_options(${LIB_NAME} PUBLIC
${XPP_FLAG}
${NETCDF_CFLAGS_OTHER}
......
......@@ -4,8 +4,7 @@ set(LIB_NAME mhm_lib)
find_package(PFUNIT)
if(PFUNIT_FOUND)
set(pfunit_suffix ".pf")
file(GLOB testfiles ./*${pfunit_suffix})
file(GLOB testfiles ./*.pf)
foreach(file ${testfiles})
get_filename_component(testname ${file} NAME_WE)
add_pfunit_ctest(${testname}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment