Add fenceposting so DLL flags are only introduced wwhen we are compiling DLL-based shared libraries.

This commit is contained in:
Ward Fisher 2023-11-01 11:45:31 -06:00
parent b9adb697ac
commit e92404f11f

View File

@ -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})
@ -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()