Skip to content

Commit

Permalink
Add fenceposting so DLL flags are only introduced wwhen we are compil…
Browse files Browse the repository at this point in the history
…ing DLL-based shared libraries.
  • Loading branch information
WardF committed Nov 1, 2023
1 parent b9adb69 commit e92404f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions nczarr_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ ENDIF()
IF(ENABLE_TESTS)

add_library(ut_util STATIC ut_util.c ut_test.c ut_includes.h ut_test.h ${XGETOPTSRC})
target_compile_definitions(ut_util PUBLIC -DDLL_EXPORT -DDLL_NETCDF)
IF(ENABLE_DLL)
target_compile_definitions(ut_util PUBLIC -DDLL_EXPORT -DDLL_NETCDF)
ENDIF(ENABLE_DLL)
target_include_directories(ut_util PUBLIC ../libnczarr ../plugins ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(ut_util PUBLIC netcdf ${ALL_TLL_LIBS})

add_library(test_utils STATIC test_utils.c test_utils.h ${XGETOPTSRC})
target_compile_definitions(test_utils PUBLIC -DDLL_EXPORT -DDLL_NETCDF)
IF(ENABLE_DLL)
target_compile_definitions(test_utils PUBLIC -DDLL_EXPORT -DDLL_NETCDF)
ENDIF(ENABLE_DLL)
target_include_directories(test_utils PUBLIC ../libnczarr ../plugins ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(test_utils PUBLIC netcdf ${ALL_TLL_LIBS})

Expand All @@ -74,13 +78,17 @@ IF(ENABLE_TESTS)

macro(build_bin_test_with_util_lib F UTIL_LIB)
build_bin_test(${F})
target_compile_definitions(${F} PUBLIC -DDLL_NETCDF)
IF(ENABLE_DLL)
target_compile_definitions(${F} PUBLIC -DDLL_NETCDF)
ENDIF(ENABLE_DLL)
target_link_libraries(${F} ${UTIL_LIB} ${ALL_TLL_LIBS})
endmacro()

macro(add_bin_test_with_util_lib PREFIX F UTIL_LIB)
add_bin_test(${PREFIX} ${F})
target_compile_definitions(${PREFIX}_${F} PUBLIC -DDLL_NETCDF)
IF(ENABLE_DLL)
target_compile_definitions(${PREFIX}_${F} PUBLIC -DDLL_NETCDF)
ENDIF(ENABLE_DLL)
target_link_libraries(${PREFIX}_${F} ${UTIL_LIB} ${ALL_TLL_LIBS})

endmacro()
Expand Down

0 comments on commit e92404f

Please sign in to comment.