diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c7e6aac..4f13c3a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,10 @@ target_include_directories(trlib $ $) -target_link_libraries(trlib ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} m) +target_link_libraries(trlib ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) +if(NOT WIN32) + target_link_libraries(trlib m) +endif() set_property(TARGET trlib PROPERTY C_STANDARD 11) add_library("trlib::trlib" ALIAS trlib) @@ -40,9 +43,15 @@ if(APPLE) set_property(TARGET trlib PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") endif(APPLE) +if(MSVC) + set_property(TARGET trlib PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + install(TARGETS trlib EXPORT trlib-config - DESTINATION lib) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin) install(EXPORT trlib-config NAMESPACE "trlib::" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 068f559..2054835 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -45,7 +45,7 @@ if(CHECK_FOUND) target_include_directories("test_${t}" PRIVATE "${PROJECT_BINARY_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}" ${CHECK_INCLUDE_DIRS}) add_test("test_${t}" "${CMAKE_CURRENT_BINARY_DIR}/test_${t}") - if(APPLE) + if(APPLE OR WIN32) else() add_custom_command(OUTPUT "test_${t}_valgrind.c" COMMAND sed "'/sr = srunner_create(s);/a srunner_set_fork_status(sr, CK_NOFORK);'" "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c" > "test_${t}_valgrind.c" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c") add_executable("test_${t}_valgrind" "test_${t}_valgrind.c" "${CMAKE_CURRENT_SOURCE_DIR}/trlib_test.c" ${MESSAGEFILES})