Skip to content

Commit

Permalink
BUG: Need to not add libm when building on Windows. (#470)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Cera <tim@cerazone.net>
Co-authored-by: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 14, 2024
1 parent f14fc6a commit 3529dcf
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,16 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/grib2.h.in" "${CMAKE_CURRENT_BINARY_
target_include_directories(${lib_name}_objlib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)

target_link_libraries(${lib_name}_objlib INTERFACE m)
if(BUILD_SHARED_LIBS)
target_link_libraries(${lib_name}_shared INTERFACE m)
endif()
if(BUILD_STATIC_LIBS)
target_link_libraries(${lib_name}_static INTERFACE m)
if (NOT WIN32)
target_link_libraries(${lib_name}_objlib INTERFACE m)
if(BUILD_SHARED_LIBS)
target_link_libraries(${lib_name}_shared INTERFACE m)
endif()
if(BUILD_STATIC_LIBS)
target_link_libraries(${lib_name}_static INTERFACE m)
endif()
endif()

if (WIN32)
target_link_libraries(${lib_name}_objlib INTERFACE ws2_32)
endif()
Expand Down

0 comments on commit 3529dcf

Please sign in to comment.