From 96c5cbfdf2e9cbe85b81cf84f84908e5cdd2570c Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 12 Aug 2024 17:17:32 +0200 Subject: [PATCH] CI --- cmake/common.cmake | 10 ++++++++++ src/CMakeLists.txt | 10 +++------- src/debug.cpp | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cmake/common.cmake b/cmake/common.cmake index 6939ca93b..214be6d69 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -313,3 +313,13 @@ function(redhat_based _RESULT) endif() set(${_RESULT} ${_REDHAT_BASED} PARENT_SCOPE) endfunction() + +function(apply_libxml2_settings _TARGET) + if(HAVE_LIBXML2_CONFIG) + target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_TARGET_NAME}) + else() + target_include_directories(${_TARGET} PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES}) + target_compile_definitions(${_TARGET} PUBLIC ${LIBXML2_DEFINITIONS}) + endif() +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30a60d5bc..eb748bf9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -193,13 +193,7 @@ else() target_include_directories(cellml PUBLIC ${ZLIB_INCLUDE_DIRS}) endif() -if(HAVE_LIBXML2_CONFIG) - target_link_libraries(cellml PUBLIC ${LIBXML2_TARGET_NAME}) -else() - target_include_directories(cellml PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) - target_link_libraries(cellml PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES}) - target_compile_definitions(cellml PUBLIC ${LIBXML2_DEFINITIONS}) -endif() +apply_libxml2_settings(cellml) # Use target compile features to propagate features to consuming projects. target_compile_features(cellml PUBLIC cxx_std_17) @@ -231,6 +225,8 @@ target_include_directories(cellml_debug_utilities $ ) +apply_libxml2_settings(cellml_debug_utilities) + set_target_properties(cellml_debug_utilities PROPERTIES CXX_VISIBILITY_PRESET hidden DEBUG_POSTFIX d diff --git a/src/debug.cpp b/src/debug.cpp index 24e1ba81b..a1a92ac88 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,11 +26,11 @@ limitations under the License. #include "libcellml/model.h" #include "libcellml/variable.h" -#include "libcellml/undefines.h" - #include "commonutils.h" #include "utilities.h" +#include "libcellml/undefines.h" + namespace libcellml { std::string astAsCode(const AnalyserEquationAstPtr &ast)