fix(cmakelists.txt): remove -lm for msvc compilation

This commit is contained in:
2025-06-23 00:26:03 +02:00
parent 2a747b80d7
commit 8fbefc7e09

View File

@@ -7,7 +7,10 @@ file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.c)
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS src/*.h)
add_executable(main ${SOURCES} ${HEADERS})
target_link_libraries(main m)
if(NOT MSVC)
target_link_libraries(main m)
endif()
# ==== tests ====
enable_testing()
@@ -17,6 +20,8 @@ list(FILTER SOURCES EXCLUDE REGEX ".*src/main\\.c$")
if(TEST_SOURCES)
add_executable(tests ${TEST_SOURCES} ${SOURCES})
target_link_libraries(tests m)
if(NOT MSVC)
target_link_libraries(tests m)
endif()
add_test(NAME tests COMMAND tests)
endif()