Skip to content

Commit

Permalink
cmake: examples: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jul 22, 2024
1 parent 326baa6 commit 6dc407b
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15...3.28)
cmake_minimum_required(VERSION 3.22...3.30)

project(nc4fortranExample
LANGUAGES C Fortran
Expand Down Expand Up @@ -30,18 +30,16 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
get_property(incdir TARGET nc4fortran::nc4fortran PROPERTY INTERFACE_INCLUDE_DIRECTORIES)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
if(WIN32)
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${incdir}/../bin"
)
elseif(APPLE)
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "DYLD_LIBRARY_PATH=path_list_prepend:${incdir}/../lib"
)
else()
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "LD_LIBRARY_PATH=path_list_prepend:${incdir}/../lib"
)
endif()
if(WIN32)
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${incdir}/../bin"
)
elseif(APPLE)
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "DYLD_LIBRARY_PATH=path_list_prepend:${incdir}/../lib"
)
else()
set_property(TEST ${test_names} PROPERTY
ENVIRONMENT_MODIFICATION "LD_LIBRARY_PATH=path_list_prepend:${incdir}/../lib"
)
endif()

0 comments on commit 6dc407b

Please sign in to comment.