actually perform system tinyxml2 build on macos / fixed system tinyxml2 include (#4445)
* lib/CMakeLists.txt: removed unnecessary external include * look up tinyxml2 include dir when using system one and specify it * lib/CMakeLists.txt: do not treat bundled headers as system ones * CI-unixish.yml: actually perform system tinyxml2 build on macos
This commit is contained in:
parent
2d37a77281
commit
b3762cd76a
|
@ -22,7 +22,6 @@ jobs:
|
|||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
with:
|
||||
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
|
||||
|
||||
|
@ -36,7 +35,7 @@ jobs:
|
|||
- name: Install missing software on macos
|
||||
if: contains(matrix.os, 'macos')
|
||||
run: |
|
||||
brew install coreutils qt@5
|
||||
brew install coreutils qt@5 tinyxml2
|
||||
|
||||
- name: CMake build on ubuntu (with GUI / system tinyxml2)
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
|
@ -44,8 +43,13 @@ jobs:
|
|||
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
cmake --build cmake.output.tinyxml2 -- -j$(nproc)
|
||||
|
||||
- name: CMake build on macos (with GUI / system tinyxml2)
|
||||
if: contains(matrix.os, 'macos')
|
||||
run: |
|
||||
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5
|
||||
cmake --build cmake.output.tinyxml2 -- -j$(nproc)
|
||||
|
||||
- name: Run CMake test (system tinyxml2)
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ add_library(cli_objs OBJECT ${hdrs} ${srcs})
|
|||
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
else()
|
||||
target_include_directories(cli_objs SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
|
||||
|
@ -24,6 +26,8 @@ add_executable(cppcheck ${cppcheck_SOURCES})
|
|||
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
else()
|
||||
target_include_directories(cppcheck SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
target_include_directories(cppcheck PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
if (HAVE_RULES)
|
||||
|
|
|
@ -58,9 +58,11 @@ if (NOT USE_BUNDLED_TINYXML2)
|
|||
find_package(tinyxml2 QUIET)
|
||||
if (TARGET tinyxml2::tinyxml2)
|
||||
set(tinyxml2_LIBRARIES "tinyxml2::tinyxml2")
|
||||
set(tinyxml2_INCLUDE_DIRS $<TARGET_PROPERTY:tinyxml2::tinyxml2,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
else()
|
||||
find_library(tinyxml2_LIBRARIES tinyxml2)
|
||||
if (NOT tinyxml2_LIBRARIES)
|
||||
find_path(tinyxml2_INCLUDE_DIRS tinyxml2.h)
|
||||
if (NOT tinyxml2_LIBRARIES AND NOT tinyxml2_INCLUDE_DIRS)
|
||||
message(FATAL_ERROR "tinyxml2 has not been found")
|
||||
else()
|
||||
set(tinyxml2_FOUND 1)
|
||||
|
|
|
@ -67,6 +67,7 @@ message( STATUS )
|
|||
message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" )
|
||||
if (NOT USE_BUNDLED_TINYXML2)
|
||||
message(STATUS "tinyxml2_LIBRARIES = ${tinyxml2_LIBRARIES}")
|
||||
message(STATUS "tinyxml2_INCLUDE_DIRS = ${tinyxml2_INCLUDE_DIRS}")
|
||||
endif()
|
||||
message( STATUS )
|
||||
message( STATUS "USE_BOOST = ${USE_BOOST}" )
|
||||
|
|
|
@ -29,6 +29,8 @@ if (BUILD_GUI)
|
|||
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
else()
|
||||
target_include_directories(cppcheck-gui SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
if (HAVE_RULES)
|
||||
target_link_libraries(cppcheck-gui ${PCRE_LIBRARY})
|
||||
|
|
|
@ -33,12 +33,13 @@ else()
|
|||
endif()
|
||||
|
||||
add_library(lib_objs OBJECT ${srcs_lib} ${hdrs})
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
else()
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/picojson/)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/picojson/)
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
if (HAVE_RULES)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PCRE_INCLUDE})
|
||||
endif()
|
||||
|
@ -49,3 +50,10 @@ endif()
|
|||
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
|
||||
target_precompile_headers(lib_objs PRIVATE precompiled.h)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# -Wfloat-equal is generated by picojson.h
|
||||
set_source_files_properties(cppcheck.cpp PROPERTIES COMPILE_FLAGS -Wno-float-equal)
|
||||
set_source_files_properties(importproject.cpp PROPERTIES COMPILE_FLAGS -Wno-float-equal)
|
||||
set_source_files_properties(settings.cpp PROPERTIES COMPILE_FLAGS -Wno-float-equal)
|
||||
endif()
|
||||
|
|
|
@ -10,6 +10,8 @@ if (BUILD_TESTS)
|
|||
target_include_directories(testrunner PRIVATE ${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/cli/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(testrunner PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2)
|
||||
else()
|
||||
target_include_directories(testrunner SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
target_include_directories(testrunner PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
if (HAVE_RULES)
|
||||
|
|
Loading…
Reference in New Issue