@@ -19,11 +19,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
1919 SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmaybe-uninitialized" )
2020endif ()
2121
22- find_library (UNO REQUIRED )
23- add_executable (tests_hs015 tests_hs015.c )
22+ # external dependencies
23+ set (LIBRARIES "" )
24+ # additional libraries to link against
25+ set (AUXILIARY_LIBRARIES "" CACHE STRING "Additional libraries to link against" )
2426
25- # link the math library and Uno
26- target_link_libraries (tests_hs015 PUBLIC m ${UNO} )
27+ # Uno
28+ find_library (UNO REQUIRED )
29+ list (APPEND LIBRARIES m ${UNO} ) # math library and Uno
2730
2831# LAPACK
2932# convert relative paths of LAPACK to absolute paths
@@ -33,10 +36,10 @@ if(LAPACK_LIBRARIES)
3336 get_filename_component (absolute_path "${relative_path} " ABSOLUTE )
3437 list (APPEND ABSOLUTE_LAPACK_LIBRARIES "${absolute_path} " )
3538 endforeach ()
36- target_link_libraries ( tests_hs015 PRIVATE ${ABSOLUTE_LAPACK_LIBRARIES} )
39+ list ( APPEND LIBRARIES ${ABSOLUTE_LAPACK_LIBRARIES} )
3740else ()
3841 find_package (LAPACK REQUIRED )
39- target_link_libraries ( tests_hs015 PRIVATE LAPACK::LAPACK )
42+ list ( APPEND LIBRARIES LAPACK::LAPACK)
4043endif ()
4144
4245# BLAS
@@ -47,8 +50,22 @@ if(BLAS_LIBRARIES)
4750 get_filename_component (absolute_path "${relative_path} " ABSOLUTE )
4851 list (APPEND ABSOLUTE_BLAS_LIBRARIES "${absolute_path} " )
4952 endforeach ()
50- target_link_libraries ( tests_hs015 PRIVATE ${ABSOLUTE_BLAS_LIBRARIES} )
53+ list ( APPEND LIBRARIES ${ABSOLUTE_BLAS_LIBRARIES} )
5154else ()
5255 find_package (BLAS REQUIRED )
53- target_link_libraries ( tests_hs015 PRIVATE BLAS::BLAS )
56+ list ( APPEND LIBRARIES BLAS::BLAS)
5457endif ()
58+
59+ # add the auxiliary libraries last
60+ if (AUXILIARY_LIBRARIES)
61+ set (ABSOLUTE_AUXILIARY_LIBRARIES)
62+ foreach (relative_path IN LISTS AUXILIARY_LIBRARIES)
63+ get_filename_component (absolute_path "${relative_path} " ABSOLUTE )
64+ list (APPEND ABSOLUTE_AUXILIARY_LIBRARIES "${absolute_path} " )
65+ endforeach ()
66+ list (APPEND LIBRARIES ${ABSOLUTE_AUXILIARY_LIBRARIES} )
67+ endif ()
68+
69+ # tests
70+ add_executable (tests_hs015 tests_hs015.c )
71+ target_link_libraries (tests_hs015 PUBLIC ${LIBRARIES} )
0 commit comments