react-native-nitro-xlsx 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroXlsx.podspec +26 -27
- package/Package.swift +31 -10
- package/README.md +21 -9
- package/android/CMakeLists.txt +20 -27
- package/cpp/HybridNitroXlsx.cpp +25 -1
- package/cpp/HybridXlsxCellFormat.cpp +46 -146
- package/cpp/HybridXlsxCellFormat.hpp +9 -41
- package/cpp/HybridXlsxConditionalFormat.cpp +4 -1
- package/cpp/HybridXlsxConditionalFormats.cpp +5 -1
- package/cpp/HybridXlsxWorkbook.cpp +38 -8
- package/cpp/HybridXlsxWorkbook.hpp +10 -1
- package/cpp/HybridXlsxWorksheet.cpp +422 -141
- package/cpp/HybridXlsxWorksheet.hpp +4 -1
- package/cpp/XlsxCacheDir.cpp +25 -2
- package/cpp/XlsxCacheDir.hpp +3 -1
- package/cpp/XlsxCellStyle.hpp +360 -0
- package/cpp/XlsxJson.cpp +29 -8
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/scripts/sync-openxlsx-headers.sh +34 -0
- package/src/__mocks__/react-native-nitro-modules.ts +523 -20
- package/src/__tests__/index.test.ts +124 -16
- package/src/index.ts +13 -13
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +46 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/scripts/prepare-openxlsx.js +0 -126
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# Author
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# The function manage_dependency is a friendly contribution by NLATP (openxlsx.genetics016@passinbox.com)
|
|
5
|
+
# The rest of the module is written by Lars Uffmann (coding23@uffmann.name) in an attempt to better understand CMake platform independency
|
|
6
|
+
# (yes, this is still giving me headaches)
|
|
7
|
+
|
|
8
|
+
# ============================================================================
|
|
9
|
+
# Policy Settings - to be controlled by the main project file
|
|
10
|
+
# ============================================================================
|
|
11
|
+
# set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Respect BUILD_SHARED_LIBS / suppress warning in nowide - TBD if this is unproblematic
|
|
12
|
+
# if(POLICY CMP0077)
|
|
13
|
+
# cmake_policy(SET CMP0077 NEW) # Respect BUILD_SHARED_LIBS
|
|
14
|
+
# endif()
|
|
15
|
+
#
|
|
16
|
+
# set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
|
|
17
|
+
# if(POLICY CMP0167)
|
|
18
|
+
# cmake_policy(SET CMP0167 NEW) # find the upstream BoostConfig.cmake directly
|
|
19
|
+
# endif()
|
|
20
|
+
|
|
21
|
+
# ============================================================================
|
|
22
|
+
# Configuration Options, to be configured in caller CMakeLists.txt
|
|
23
|
+
# ============================================================================
|
|
24
|
+
# option(PREFER_STATIC "Prefer static linking over shared libraries" ON)
|
|
25
|
+
# option(USE_SYSTEM_LIBS "Use system-installed libraries when available" ON)
|
|
26
|
+
# option(FETCH_DEPS_AUTO "Automatically fetch missing dependencies" ON)
|
|
27
|
+
# option(FORCE_FETCH_ALL "Ignore system libraries and fetch all deps" OFF)
|
|
28
|
+
|
|
29
|
+
# ============================================================================
|
|
30
|
+
# Safety Checks - to be handled in main project file
|
|
31
|
+
# ============================================================================
|
|
32
|
+
# if(FORCE_FETCH_ALL)
|
|
33
|
+
# set(USE_SYSTEM_LIBS OFF CACHE BOOL "" FORCE)
|
|
34
|
+
# message(STATUS "FORCE_FETCH_ALL enabled: ignoring system libraries")
|
|
35
|
+
# endif()
|
|
36
|
+
|
|
37
|
+
# ============================================================================
|
|
38
|
+
# Dependency Checks - verify that required modules are present
|
|
39
|
+
# NOTE: as stupid as this is, in order to safely include a module from the same path as this file, two different variables are needed:
|
|
40
|
+
# 1) outside a function: CMAKE_CURRENT_LIST_DIR (the below is not defined)
|
|
41
|
+
# 2) inside a function: CMAKE_CURRENT_FUNCTION_LIST_DIR (the above will have the path to the script from which the function stack is invoked)
|
|
42
|
+
# (this is used in write_find_test_config to write CMakeLists.txt for the TestPackage sub-project)
|
|
43
|
+
# CMAKE_SOURCE_DIR (with correct subdirectory to scripts) becomes unpredictable / invalid the moment that this project is included from a super-project
|
|
44
|
+
# ============================================================================
|
|
45
|
+
include(${CMAKE_CURRENT_LIST_DIR}/recursive_library_type_test.cmake) # not actually invoked from here, but from project created by write_find_test_config
|
|
46
|
+
|
|
47
|
+
# ============================================================================
|
|
48
|
+
# Enhanced Helper Functions
|
|
49
|
+
# ============================================================================
|
|
50
|
+
|
|
51
|
+
# Function: FetchContent_Declare_custom
|
|
52
|
+
# Purpose: Provide an alternative to FetchContent_Declare with the option to EXCLUDE_FROM_ALL
|
|
53
|
+
# Options:
|
|
54
|
+
# EXCLUDE_FROM_ALL if supported, pass EXCLUDE_FROM_ALL on to FetchContent_Declare
|
|
55
|
+
# Parameters:
|
|
56
|
+
# LIB_NAME name of the library to make available, as to be passed to FetchContent_Declare
|
|
57
|
+
# URL if provided together with a hash, declare content for fetching from URL
|
|
58
|
+
# URL_HASH must be provided with URL or URL won't be used
|
|
59
|
+
# GIT_REPOSITORY if URL or URL_HASH are missing: declare content for fetching from this repository
|
|
60
|
+
# GIT_TAG must be provided with GIT_REPOSITORY
|
|
61
|
+
# Author: Lars Uffmann (coding23@uffmann.name)
|
|
62
|
+
function(FetchContent_Declare_custom)
|
|
63
|
+
set(options "EXCLUDE_FROM_ALL")
|
|
64
|
+
set(oneValueArgs
|
|
65
|
+
LIB_NAME
|
|
66
|
+
URL
|
|
67
|
+
URL_HASH
|
|
68
|
+
GIT_REPOSITORY
|
|
69
|
+
GIT_TAG
|
|
70
|
+
)
|
|
71
|
+
set(multiValueArgs EXTRA_ARGS)
|
|
72
|
+
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
73
|
+
|
|
74
|
+
# empty initializers for all parameters to FetchContent_Declare
|
|
75
|
+
set( URL_PARAM )
|
|
76
|
+
set( URL_HASH_PARAM )
|
|
77
|
+
set( URL_EXTRA_PARAMS )
|
|
78
|
+
set( GIT_REPO_PARAM )
|
|
79
|
+
set( GIT_TAG_PARAM )
|
|
80
|
+
set( GIT_EXTRA_PARAMS )
|
|
81
|
+
set( SHARED_PARAMS )
|
|
82
|
+
|
|
83
|
+
# initialize source parameters
|
|
84
|
+
if( ( "${ARG_URL}" STREQUAL "" ) OR ( "${ARG_URL_HASH}" STREQUAL "" ) )
|
|
85
|
+
message( STATUS "Fetching ${ARG_LIB_NAME} from repository ${ARG_GIT_REPOSITORY} with GIT_TAG ${ARG_GIT_TAG}" )
|
|
86
|
+
|
|
87
|
+
# set( GIT_REPO_PARAM "GIT_REPOSITORY;${ARG_GIT_REPOSITORY}" )
|
|
88
|
+
# NOTE: separating param name and value with a semicolon (above) is equivalent to list( APPEND [..] ) as seen below
|
|
89
|
+
list( APPEND GIT_REPO_PARAM GIT_REPOSITORY ${ARG_GIT_REPOSITORY} )
|
|
90
|
+
list( APPEND GIT_TAG_PARAM GIT_TAG ${ARG_GIT_TAG} )
|
|
91
|
+
list( APPEND GIT_EXTRA_PARAMS GIT_SHALLOW TRUE )
|
|
92
|
+
else()
|
|
93
|
+
message( STATUS "Fetching ${ARG_LIB_NAME} via URL ${ARG_URL}" )
|
|
94
|
+
|
|
95
|
+
list( APPEND URL_PARAM URL ${ARG_URL} )
|
|
96
|
+
list( APPEND URL_HASH_PARAM URL_HASH ${ARG_URL_HASH} )
|
|
97
|
+
list( APPEND URL_EXTRA_PARAMS DOWNLOAD_EXTRACT_TIMESTAMP OFF ) # set extracted file timestamps to current time to ensure extraction triggers compilation
|
|
98
|
+
endif()
|
|
99
|
+
list( APPEND SHARED_PARAMS OVERRIDE_FIND_PACKAGE ) # Important: override system package
|
|
100
|
+
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.30" )
|
|
101
|
+
if( ARG_EXCLUDE_FROM_ALL )
|
|
102
|
+
message( VERBOSE "FetchContent_Declare in CMake >= 3.30 will be invoked with EXCLUDE_FROM_ALL" )
|
|
103
|
+
list( APPEND SHARED_PARAMS EXCLUDE_FROM_ALL )
|
|
104
|
+
endif()
|
|
105
|
+
endif()
|
|
106
|
+
|
|
107
|
+
FetchContent_Declare(
|
|
108
|
+
${ARG_LIB_NAME}
|
|
109
|
+
${URL_PARAM}
|
|
110
|
+
${URL_HASH_PARAM}
|
|
111
|
+
${URL_EXTRA_PARAMS}
|
|
112
|
+
${GIT_REPO_PARAM}
|
|
113
|
+
${GIT_TAG_PARAM}
|
|
114
|
+
${GIT_EXTRA_PARAMS}
|
|
115
|
+
${SHARED_PARAMS}
|
|
116
|
+
)
|
|
117
|
+
endfunction()
|
|
118
|
+
# End of Function: FetchContent_Declare_custom
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# Function: FetchContent_MakeAvailable_custom
|
|
122
|
+
# Purpose: Provide an alternative to FetchContent_MakeAvailable with the option to EXCLUDE_FROM_ALL in case FetchContent_Declare
|
|
123
|
+
# does not support it
|
|
124
|
+
# Options:
|
|
125
|
+
# EXCLUDE_FROM_ALL FetchContent_MakeAvailable (CMake >= 3.30) or add_subdirectory will be executed with EXCLUDE_FROM_ALL
|
|
126
|
+
# Parameters:
|
|
127
|
+
# LIB_NAME name of the library to make available, as previously prepared with FetchContent_Declare
|
|
128
|
+
# Author: Lars Uffmann (coding23@uffmann.name)
|
|
129
|
+
function(FetchContent_MakeAvailable_custom)
|
|
130
|
+
set(options "EXCLUDE_FROM_ALL")
|
|
131
|
+
set(oneValueArgs
|
|
132
|
+
LIB_NAME
|
|
133
|
+
)
|
|
134
|
+
set(multiValueArgs EXTRA_ARGS)
|
|
135
|
+
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
136
|
+
|
|
137
|
+
# empty initializers for all parameters to FetchContent_MakeAvailable or add_subdirectory
|
|
138
|
+
set( EXCLUDE_FROM_ALL_PARAM ) # ignored for CMake >= 3.30
|
|
139
|
+
|
|
140
|
+
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.30" )
|
|
141
|
+
# if CMake version >= 3.30: FetchContent_Declare was invoked with EXCLUDE_FROM_ALL, now use FetchContent_MakeAvailable nominally
|
|
142
|
+
FetchContent_MakeAvailable(
|
|
143
|
+
${ARG_LIB_NAME}
|
|
144
|
+
)
|
|
145
|
+
else()
|
|
146
|
+
# older versions of CMake: fall back to a combination of FetchContent_Populate and add_subdirectory
|
|
147
|
+
|
|
148
|
+
# Logic from comment at https://stackoverflow.com/questions/65527126/disable-install-for-fetchcontent
|
|
149
|
+
FetchContent_GetProperties(${ARG_LIB_NAME})
|
|
150
|
+
if(NOT ${ARG_LIB_NAME}_POPULATED)
|
|
151
|
+
FetchContent_Populate(${ARG_LIB_NAME})
|
|
152
|
+
string( TOLOWER ${ARG_LIB_NAME} LIB_NAME_LOWER ) # FetchContent_Populate populates variables with ARG_LIB_NAME in all lowercase
|
|
153
|
+
if( ARG_EXCLUDE_FROM_ALL )
|
|
154
|
+
message( STATUS "-- FetchContent_MakeAvailable_custom (${ARG_LIB_NAME}): add_subdirectory will be used with EXCLUDE_FROM_ALL" )
|
|
155
|
+
list( APPEND EXCLUDE_FROM_ALL_PARAM EXCLUDE_FROM_ALL ) # Ensure that the dependency is not installed if EXCLUDE_FROM_ALL is active
|
|
156
|
+
endif()
|
|
157
|
+
add_subdirectory(
|
|
158
|
+
${${LIB_NAME_LOWER}_SOURCE_DIR}
|
|
159
|
+
${${LIB_NAME_LOWER}_BINARY_DIR}
|
|
160
|
+
${EXCLUDE_FROM_ALL_PARAM}
|
|
161
|
+
)
|
|
162
|
+
endif()
|
|
163
|
+
endif()
|
|
164
|
+
endfunction()
|
|
165
|
+
# End of Function: FetchContent_MakeAvailable_custom
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# Function: write_find_test_config
|
|
169
|
+
# Purpose: in ARG_TEMP_SRC_DIR, create a CMakeLists.txt with the sole purpose of attempting to find_package for a required library type
|
|
170
|
+
# Parameters:
|
|
171
|
+
# ARG_TEMP_SRC_DIR the (temporary) directory in which to create CMakeLists.txt
|
|
172
|
+
# Returns: N/A
|
|
173
|
+
# Author: Lars Uffmann (coding23@uffmann.name)
|
|
174
|
+
function(write_find_test_config ARG_TEMP_SRC_DIR)
|
|
175
|
+
file(WRITE "${ARG_TEMP_SRC_DIR}/CMakeLists.txt"
|
|
176
|
+
"cmake_minimum_required(VERSION 3.15)
|
|
177
|
+
project(TestPackage VERSION 0.1 LANGUAGES CXX)
|
|
178
|
+
# Script: CMakeLists.txt
|
|
179
|
+
# Purpose: demonstrate finding a required library type (static vs. shared) with Boost nowide as example
|
|
180
|
+
# Example Usage: refer to OpenXLSX cmake log output following \"-- run_test_package: testing package Boost with command:\"
|
|
181
|
+
|
|
182
|
+
include(\"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/recursive_library_type_test.cmake\")
|
|
183
|
+
|
|
184
|
+
if(NOT DEFINED TEST_PACKAGE_NAME)
|
|
185
|
+
message( FATAL_ERROR \"TEST_PACKAGE_NAME undefined\" )
|
|
186
|
+
endif()
|
|
187
|
+
if(NOT DEFINED TEST_VERSION)
|
|
188
|
+
message( FATAL_ERROR \"TEST_VERSION undefined\" )
|
|
189
|
+
endif()
|
|
190
|
+
if(NOT DEFINED TEST_EXTRA_ARGS)
|
|
191
|
+
message( FATAL_ERROR \"TEST_EXTRA_ARGS undefined\" )
|
|
192
|
+
endif()
|
|
193
|
+
if(NOT DEFINED TEST_COMPONENTS_PARAM)
|
|
194
|
+
message( FATAL_ERROR \"TEST_COMPONENTS_PARAM undefined\" )
|
|
195
|
+
endif()
|
|
196
|
+
if(NOT DEFINED TEST_TARGET_NAME_SYSTEM)
|
|
197
|
+
message( FATAL_ERROR \"TEST_TARGET_NAME_SYSTEM undefined\" )
|
|
198
|
+
endif()
|
|
199
|
+
if(NOT DEFINED TEST_REQUIRED_TYPE)
|
|
200
|
+
message( FATAL_ERROR \"TEST_REQUIRED_TYPE undefined\" )
|
|
201
|
+
endif()
|
|
202
|
+
if(NOT DEFINED TEST_FIND_LIBRARY_SUFFIXES)
|
|
203
|
+
message( FATAL_ERROR \"TEST_FIND_LIBRARY_SUFFIXES undefined\" )
|
|
204
|
+
endif()
|
|
205
|
+
|
|
206
|
+
# configure FIND_LIBRARY_SUFFIXES - setting will be forgotten when this script completes
|
|
207
|
+
set( CMAKE_FIND_LIBRARY_SUFFIXES \${TEST_FIND_LIBRARY_SUFFIXES} )
|
|
208
|
+
|
|
209
|
+
message( DEBUG \" TestPackage: TEST_FIND_LIBRARY_SUFFIXES is \${TEST_FIND_LIBRARY_SUFFIXES}\" )
|
|
210
|
+
|
|
211
|
+
message( STATUS \" TestPackage: attempting to find_package \${TEST_PACKAGE_NAME} version \${TEST_VERSION} with \${TEST_EXTRA_ARGS} \${TEST_COMPONENTS_PARAM}\" )
|
|
212
|
+
message( STATUS \" TestPackage: expecting to find system target \${TEST_TARGET_NAME_SYSTEM}, required library type is \\\"\${TEST_REQUIRED_TYPE}\\\", CMAKE_FIND_LIBRARY_SUFFIXES is \${CMAKE_FIND_LIBRARY_SUFFIXES}\" )
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# perform the find. NOTE: setting for CMAKE_FIND_DEBUG_MODE is inherited from the parent cmake environment via cache init file
|
|
216
|
+
find_package(
|
|
217
|
+
\${TEST_PACKAGE_NAME} \${TEST_VERSION}
|
|
218
|
+
\${TEST_EXTRA_ARGS} # QUIET can be passed here
|
|
219
|
+
\${TEST_COMPONENTS_PARAM}
|
|
220
|
+
)
|
|
221
|
+
message( DEBUG \" TestPackage: \${TEST_PACKAGE_NAME}_FOUND: \${\${TEST_PACKAGE_NAME}_FOUND}\" )
|
|
222
|
+
|
|
223
|
+
# evaluate result
|
|
224
|
+
set(\${TEST_PACKAGE_NAME}_SUITABLE_FOUND \"FALSE\")
|
|
225
|
+
if(\${TEST_PACKAGE_NAME}_FOUND)
|
|
226
|
+
message( VERBOSE \" TestPackage: Performing recursive_library_type_test on \${TEST_TARGET_NAME_SYSTEM}\" )
|
|
227
|
+
set(LIBRARY_TYPE \"INTERFACE_LIBRARY\") # default: can't resolve library type
|
|
228
|
+
recursive_library_type_test(\${TEST_TARGET_NAME_SYSTEM} \"\")
|
|
229
|
+
if(\${TEST_TARGET_NAME_SYSTEM}_HAS_STATIC)
|
|
230
|
+
if(NOT \${TEST_TARGET_NAME_SYSTEM}_HAS_SHARED)
|
|
231
|
+
set(LIBRARY_TYPE \"STATIC_LIBRARY\") # library is only static
|
|
232
|
+
endif()
|
|
233
|
+
elseif(\${TEST_TARGET_NAME_SYSTEM}_HAS_SHARED)
|
|
234
|
+
set(LIBRARY_TYPE \"SHARED_LIBRARY\") # library is only shared
|
|
235
|
+
endif()
|
|
236
|
+
message( VERBOSE \" TestPackage: recursive_library_type_test on \${TEST_TARGET_NAME_SYSTEM} determined type \${LIBRARY_TYPE}\" )
|
|
237
|
+
|
|
238
|
+
# Final check: LIBRARY_TYPE must match expected type, if any
|
|
239
|
+
if(\"\${TEST_REQUIRED_TYPE}\" STREQUAL \"\" OR \"\${LIBRARY_TYPE}\" STREQUAL \"\${TEST_REQUIRED_TYPE}\")
|
|
240
|
+
message( VERBOSE \" TestPackage: \${TEST_TARGET_NAME_SYSTEM} type matches required type \${TEST_REQUIRED_TYPE}\" )
|
|
241
|
+
if(TARGET \${TEST_TARGET_NAME_SYSTEM})
|
|
242
|
+
set(\${TEST_PACKAGE_NAME}_SUITABLE_FOUND \"TRUE\")
|
|
243
|
+
else()
|
|
244
|
+
message( WARNING \"TestPackage: expected TARGET \${TEST_TARGET_NAME_SYSTEM} is not available!\" )
|
|
245
|
+
endif()
|
|
246
|
+
else()
|
|
247
|
+
message( WARNING \"TestPackage: \${TEST_TARGET_NAME_SYSTEM} type does not match required type \${TEST_REQUIRED_TYPE}\" )
|
|
248
|
+
endif()
|
|
249
|
+
endif()
|
|
250
|
+
|
|
251
|
+
# cmake is a piece of work, so work around cache corruption by emitting the TestPackage result only as a string
|
|
252
|
+
# also, must emit message as STATUS severity, because NOTICE ends up in execute_process ERROR_VARIABLE
|
|
253
|
+
message( STATUS \"\${TEST_PACKAGE_NAME}_SUITABLE_FOUND:STRING=\${\${TEST_PACKAGE_NAME}_SUITABLE_FOUND}\" )
|
|
254
|
+
"
|
|
255
|
+
)
|
|
256
|
+
endfunction()
|
|
257
|
+
# End of Function: write_find_test_config
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
# Function: write_parent_cache_init
|
|
261
|
+
# Author: unknown, stolen without attribution by a slop generator :(, then heavily modified
|
|
262
|
+
# Usage:
|
|
263
|
+
# write_parent_cache_init(
|
|
264
|
+
# OUTPUT_FILE "${DEST_DIR}/${OUTFILE}.cmake"
|
|
265
|
+
# INCLUDE_FILTER_REGEX "^(INCLUDE_THESE_).*"
|
|
266
|
+
# EXCLUDE_FILTER_REGEX "^(EXCLUDE_THESE).*"
|
|
267
|
+
# )
|
|
268
|
+
# Parameters:
|
|
269
|
+
# 1) output file path
|
|
270
|
+
# 2) optional regex to select which cache variable names to include (default: include everything)
|
|
271
|
+
# 3) optional regex to select which cache variable names to exclude (default: exclude nothing)
|
|
272
|
+
function( write_parent_cache_init )
|
|
273
|
+
set(options)
|
|
274
|
+
set(oneValueArgs
|
|
275
|
+
OUTPUT_FILE
|
|
276
|
+
INCLUDE_FILTER_REGEX
|
|
277
|
+
EXCLUDE_FILTER_REGEX
|
|
278
|
+
)
|
|
279
|
+
cmake_parse_arguments(_args "${options}" "${oneValueArgs}" "" ${ARGN})
|
|
280
|
+
|
|
281
|
+
if(NOT _args_INCLUDE_FILTER_REGEX)
|
|
282
|
+
set( _args_INCLUDE_FILTER_REGEX ".*" ) # default: include all
|
|
283
|
+
endif()
|
|
284
|
+
|
|
285
|
+
if(NOT _args_EXCLUDE_FILTER_REGEX)
|
|
286
|
+
set( _args_EXCLUDE_FILTER_REGEX "" ) # default: exclude nothing
|
|
287
|
+
endif()
|
|
288
|
+
|
|
289
|
+
# Create cache init file
|
|
290
|
+
file(WRITE "${_args_OUTPUT_FILE}" "# Auto-generated cache init file\n")
|
|
291
|
+
|
|
292
|
+
# Get all cache variable names
|
|
293
|
+
get_cmake_property(_cache_vars CACHE_VARIABLES)
|
|
294
|
+
|
|
295
|
+
# message( STATUS "regex exclude filter is ${_args_EXCLUDE_FILTER_REGEX}" )
|
|
296
|
+
foreach(_var ${_cache_vars})
|
|
297
|
+
# if( _var MATCHES "${_args_EXCLUDE_FILTER_REGEX}" )
|
|
298
|
+
# message( STATUS "_var ${_var} MATCHES regex exclude filter!" )
|
|
299
|
+
# else()
|
|
300
|
+
# message( STATUS "_var ${_var} does NOT match regex exclude filter!" )
|
|
301
|
+
# endif()
|
|
302
|
+
|
|
303
|
+
# Skip variables that don't match the INCLUDE filter
|
|
304
|
+
if( NOT _var MATCHES "${_args_INCLUDE_FILTER_REGEX}" )
|
|
305
|
+
continue()
|
|
306
|
+
endif()
|
|
307
|
+
|
|
308
|
+
# Skip variables that do match the EXCLUDE filter
|
|
309
|
+
if( _var MATCHES "${_args_EXCLUDE_FILTER_REGEX}" )
|
|
310
|
+
continue()
|
|
311
|
+
endif()
|
|
312
|
+
|
|
313
|
+
# Get type and value
|
|
314
|
+
get_property( _type CACHE ${_var} PROPERTY TYPE )
|
|
315
|
+
get_property( _value CACHE ${_var} PROPERTY VALUE )
|
|
316
|
+
# message( STATUS "var is ${_var}, type is ${_type}, value is ${_value}" )
|
|
317
|
+
|
|
318
|
+
# Skip internal or undocumented entries
|
|
319
|
+
if( _type STREQUAL "INTERNAL" )
|
|
320
|
+
continue()
|
|
321
|
+
endif()
|
|
322
|
+
|
|
323
|
+
# Default type if missing
|
|
324
|
+
if( NOT _type )
|
|
325
|
+
set( _type "STRING" )
|
|
326
|
+
endif()
|
|
327
|
+
|
|
328
|
+
# Escape double quotes and backslashes in the value
|
|
329
|
+
if( DEFINED _value )
|
|
330
|
+
string( REPLACE "\\" "\\\\" _value_esc "${_value}" )
|
|
331
|
+
string( REPLACE "\"" "\\\"" _value_esc "${_value_esc}" )
|
|
332
|
+
else()
|
|
333
|
+
set( _value_esc "" )
|
|
334
|
+
endif()
|
|
335
|
+
|
|
336
|
+
# Write a set(... CACHE ...) line
|
|
337
|
+
file( APPEND "${_args_OUTPUT_FILE}"
|
|
338
|
+
"set(${_var} \"${_value_esc}\" CACHE ${_type} \"copied from parent\")\n")
|
|
339
|
+
endforeach()
|
|
340
|
+
endfunction()
|
|
341
|
+
# End of Function: write_parent_cache_init
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
# Function: run_test_package
|
|
345
|
+
# Purpose: determine if ARG_PACKAGE_NAME can be found on the system as the REQUIRED_LIBRARY_TYPE if any
|
|
346
|
+
# Parameters:
|
|
347
|
+
# pass-through to find_package:
|
|
348
|
+
# ARG_PACKAGE_NAME
|
|
349
|
+
# ARG_VERSION
|
|
350
|
+
# ARG_EXTRA_ARGS
|
|
351
|
+
# COMPONENTS_PARAM
|
|
352
|
+
# evaluation of success:
|
|
353
|
+
# ARG_TARGET_NAME_SYSTEM used to get_target_property TYPE after successful find_package
|
|
354
|
+
# REQUIRED_LIBRARY_TYPE evaluate against TYPE of found package
|
|
355
|
+
# FIND_PACKAGE_VARIABLES a NAME VALUE NAME VALUE list of variables to configure for the test_package call
|
|
356
|
+
# FIND_LIBRARY_SUFFIXES configure CMAKE_FIND_LIBRARY_SUFFIXES to this before call to find_package - has no effect when cmake package config files are found
|
|
357
|
+
# Returns:
|
|
358
|
+
# ${PACKAGE_NAME}_SUITABLE_FOUND (PARENT_SCOPE): TRUE if dependency is available as the REQUIRED_LIBRARY_TYPE, FALSE otherwise
|
|
359
|
+
# Author: Lars Uffmann (coding23@uffmann.name)
|
|
360
|
+
function(run_test_package ARG_PACKAGE_NAME ARG_VERSION ARG_EXTRA_ARGS COMPONENTS_PARAM ARG_TARGET_NAME_SYSTEM REQUIRED_LIBRARY_TYPE FIND_PACKAGE_VARIABLES FIND_LIBRARY_SUFFIXES)
|
|
361
|
+
# configure a build directory
|
|
362
|
+
string(REPLACE ";" "_" pkg_safe "${ARG_PACKAGE_NAME}")
|
|
363
|
+
|
|
364
|
+
# escape variables that may contain a list
|
|
365
|
+
string(REPLACE ";" "\\;" PREFIX_ESCAPED "${CMAKE_PREFIX_PATH}")
|
|
366
|
+
string(REPLACE ";" "\\;" ARG_EXTRA_ARGS_ESCAPED "${ARG_EXTRA_ARGS}")
|
|
367
|
+
string(REPLACE ";" "\\;" COMPONENTS_PARAM_ESCAPED "${COMPONENTS_PARAM}")
|
|
368
|
+
|
|
369
|
+
set( PARAM_FIND_PACKAGE_VARIABLES "" ) # for CMake execute_process parameters
|
|
370
|
+
set( ECHO_FIND_PACKAGE_VARIABLES "" ) # for command echo / bash executable
|
|
371
|
+
unset( FPC_NAME )
|
|
372
|
+
unset( FPC_VALUE )
|
|
373
|
+
foreach( val IN LISTS ARG_FIND_PACKAGE_VARIABLES )
|
|
374
|
+
if(NOT FPC_NAME)
|
|
375
|
+
set(FPC_NAME ${val})
|
|
376
|
+
else()
|
|
377
|
+
set(FPC_VALUE ${val})
|
|
378
|
+
message( DEBUG " run_test_package: FIND_PACKAGE_VARIABLES ${FPC_NAME}=${FPC_VALUE}" )
|
|
379
|
+
if(NOT "${PARAM_FIND_PACKAGE_VARIABLES}" STREQUAL "") # if this is not the first parameter to be configured
|
|
380
|
+
set( PARAM_FIND_PACKAGE_VARIABLES "${PARAM_FIND_PACKAGE_VARIABLES};" ) # append a semicolon as separator -> CMake list
|
|
381
|
+
set( ECHO_FIND_PACKAGE_VARIABLES "${ECHO_FIND_PACKAGE_VARIABLES} " ) # append a space for the command echo -> bash compatible
|
|
382
|
+
endif()
|
|
383
|
+
set( PARAM_FIND_PACKAGE_VARIABLES "${PARAM_FIND_PACKAGE_VARIABLES}-D ${FPC_NAME}=${FPC_VALUE}" ) # append a parameter for the script execution environment -> CMake list
|
|
384
|
+
set( ECHO_FIND_PACKAGE_VARIABLES "${ECHO_FIND_PACKAGE_VARIABLES}-D ${FPC_NAME}=${FPC_VALUE}" ) # append a parameter for the command echo -> bash compatible
|
|
385
|
+
unset( FPC_NAME )
|
|
386
|
+
unset( FPC_VALUE )
|
|
387
|
+
endif()
|
|
388
|
+
endforeach()
|
|
389
|
+
|
|
390
|
+
# create a temp file path
|
|
391
|
+
set(_test_package_init "${TEMP_BUILD_DIR}/test_package_init.cmake")
|
|
392
|
+
|
|
393
|
+
# write all variables that hopefully won't make the subscript interfere with the OpenXLSX build
|
|
394
|
+
write_parent_cache_init(
|
|
395
|
+
OUTPUT_FILE "${_test_package_init}"
|
|
396
|
+
INCLUDE_FILTER_REGEX "^(CMAKE_|GIT_EXECUTABLE).*"
|
|
397
|
+
EXCLUDE_FILTER_REGEX "^((CMAKE_PROJECT_|CMAKE_FIND_PACKAGE_|CMAKE_RC_).*)|(.*(_DIR|_DIRECTORY))$" ) # NOTE 2026-06-01: .*_DIR and .*_DIRECTORY exclude entries are experimental
|
|
398
|
+
# 2026-06-12 exclusion added for CMAKE_RC_* - hoping that this stops pollution of the sub-script cache, requiring a reconfigure
|
|
399
|
+
|
|
400
|
+
# potentially relevant non-cache variables:
|
|
401
|
+
# message( STATUS "----------------- CMAKE_GENERATOR_TOOLSET is \"${CMAKE_GENERATOR_TOOLSET}\"" )
|
|
402
|
+
# message( STATUS "----------------- CMAKE_GENERATOR_INSTANCE is \"${CMAKE_GENERATOR_INSTANCE}\"" )
|
|
403
|
+
# message( STATUS "----------------- CMAKE_TOOLCHAIN_FILE is \"${CMAKE_TOOLCHAIN_FILE}\"" )
|
|
404
|
+
# Echo the command to be executed for TestPackage to the log so that the user can manually invoke "cmake-find-test-<package>-src/CMakeLists.txt" and experiment with the results
|
|
405
|
+
message( VERBOSE " run_test_package: testing package ${ARG_PACKAGE_NAME} with command:
|
|
406
|
+
${CMAKE_COMMAND} --no-warn-unused-cli -L -S \"${TEMP_SRC_DIR}\" \\
|
|
407
|
+
-B \"${TEMP_BUILD_DIR}\" \\
|
|
408
|
+
-C \"${_test_package_init}\" \\
|
|
409
|
+
-G \"${CMAKE_GENERATOR}\" \\
|
|
410
|
+
-D TEST_PACKAGE_NAME=${ARG_PACKAGE_NAME} \\
|
|
411
|
+
-D TEST_VERSION=${ARG_VERSION} \\
|
|
412
|
+
-D TEST_EXTRA_ARGS=${ARG_EXTRA_ARGS_ESCAPED} \\
|
|
413
|
+
-D TEST_COMPONENTS_PARAM=${COMPONENTS_PARAM_ESCAPED} \\
|
|
414
|
+
-D TEST_TARGET_NAME_SYSTEM=${ARG_TARGET_NAME_SYSTEM} \\
|
|
415
|
+
-D TEST_REQUIRED_TYPE=${REQUIRED_LIBRARY_TYPE} \\
|
|
416
|
+
-D TEST_FIND_LIBRARY_SUFFIXES=\"${FIND_LIBRARY_SUFFIXES}\" \\
|
|
417
|
+
-D CMAKE_PREFIX_PATH=${PREFIX_ESCAPED} \\
|
|
418
|
+
${ECHO_FIND_PACKAGE_VARIABLES} \\
|
|
419
|
+
--log-level ${TestPackage_LOG_LEVEL} \\
|
|
420
|
+
")
|
|
421
|
+
|
|
422
|
+
execute_process(
|
|
423
|
+
COMMAND ${CMAKE_COMMAND} --no-warn-unused-cli -L -S "${TEMP_SRC_DIR}"
|
|
424
|
+
-B "${TEMP_BUILD_DIR}"
|
|
425
|
+
-C "${_test_package_init}"
|
|
426
|
+
-G "${CMAKE_GENERATOR}"
|
|
427
|
+
-D TEST_PACKAGE_NAME=${ARG_PACKAGE_NAME}
|
|
428
|
+
-D TEST_VERSION=${ARG_VERSION}
|
|
429
|
+
-D TEST_EXTRA_ARGS=${ARG_EXTRA_ARGS_ESCAPED}
|
|
430
|
+
-D TEST_COMPONENTS_PARAM=${COMPONENTS_PARAM_ESCAPED}
|
|
431
|
+
-D TEST_TARGET_NAME_SYSTEM=${ARG_TARGET_NAME_SYSTEM}
|
|
432
|
+
-D TEST_REQUIRED_TYPE=${REQUIRED_LIBRARY_TYPE}
|
|
433
|
+
-D TEST_FIND_LIBRARY_SUFFIXES="${FIND_LIBRARY_SUFFIXES}"
|
|
434
|
+
-D CMAKE_PREFIX_PATH=${PREFIX_ESCAPED}
|
|
435
|
+
${PARAM_FIND_PACKAGE_VARIABLES}
|
|
436
|
+
--log-level ${TestPackage_LOG_LEVEL}
|
|
437
|
+
RESULT_VARIABLE test_package_success
|
|
438
|
+
OUTPUT_VARIABLE test_package_output
|
|
439
|
+
ERROR_VARIABLE test_package_err
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
message(VERBOSE " run_test_package - TestPackage result for ${ARG_PACKAGE_NAME} (test_package_success=${test_package_success})")
|
|
443
|
+
message(VERBOSE " run_test_package - TestPackage output: ${test_package_output}")
|
|
444
|
+
message(STATUS " run_test_package - TestPackage errors: ${test_package_err}")
|
|
445
|
+
|
|
446
|
+
# define function return value: ${ARG_PACKAGE_NAME}_SUITABLE_FOUND
|
|
447
|
+
set(${ARG_PACKAGE_NAME}_SUITABLE_FOUND FALSE PARENT_SCOPE)
|
|
448
|
+
if(test_package_output MATCHES "-- ${ARG_PACKAGE_NAME}_SUITABLE_FOUND:STRING=([^\r\n]+)\r?\n") # test if test_package_output contains lines like: ${ARG_PACKAGE_NAME}_SUITABLE_FOUND:STRING=<bool>
|
|
449
|
+
# message( STATUS ">>> run_test_package: found a match ${CMAKE_MATCH_1} in output" )
|
|
450
|
+
set(test_result "${CMAKE_MATCH_1}")
|
|
451
|
+
# string(STRIP "${CMAKE_MATCH_1}" test_result)
|
|
452
|
+
if("${test_result}" STREQUAL "TRUE")
|
|
453
|
+
set(${ARG_PACKAGE_NAME}_SUITABLE_FOUND TRUE PARENT_SCOPE)
|
|
454
|
+
endif()
|
|
455
|
+
endif()
|
|
456
|
+
endfunction()
|
|
457
|
+
# End of Function: run_test_package
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
# Function: manage_dependency
|
|
461
|
+
# Purpose: Safely finds or fetches a dependency
|
|
462
|
+
# Options: -
|
|
463
|
+
# Parameters: (see below)
|
|
464
|
+
# Returns:
|
|
465
|
+
# ${LIB_NAME}_FETCHED (PARENT_SCOPE): TRUE if dependency was downloaded from a repository, FALSE if dependency was provided by find_package
|
|
466
|
+
# ${LIB_NAME}_TARGET_STATIC (PARENT_SCOPE): static library target file, if any
|
|
467
|
+
# ${LIB_NAME}_PROVIDED_TARGET (PARENT_SCOPE): (potentially aliased) target provided by the dependency
|
|
468
|
+
# ${LIB_NAME}_INSTALL_TARGET (PARENT_SCOPE): (alias resolved) install target to be used for the dependency, if any
|
|
469
|
+
# Author: This function is a friendly contribution by NLATP (openxlsx.genetics016@passinbox.com)
|
|
470
|
+
function(manage_dependency)
|
|
471
|
+
set(options "")
|
|
472
|
+
set(oneValueArgs
|
|
473
|
+
LIB_NAME # an arbitrary library name, for which ${LIB_NAME}_FETCHED will be set to TRUE for the caller in case of success
|
|
474
|
+
PACKAGE_NAME # the system library package name
|
|
475
|
+
VERSION # local required version for find_package with PACKAGE_NAME
|
|
476
|
+
#
|
|
477
|
+
GITHUB_REPO # use for github repositories only
|
|
478
|
+
GIT_REPOSITORY # use to provide a full repository URL
|
|
479
|
+
GIT_TAG # use this to supply the github version tag (can be preceeded by a 'v' whereas VERSION is typically(?) numerical only
|
|
480
|
+
HEADER_FILE # TBD: what is the point of HEADER_FILE?
|
|
481
|
+
URL # URL & URL_HASH can be used together instead of GITHUB_REPO & GIT_TAG
|
|
482
|
+
URL_HASH #
|
|
483
|
+
#
|
|
484
|
+
TARGET_NAME # expected target (can be an alias) that should be provided by the dependency
|
|
485
|
+
TARGET_NAME_SYSTEM # this is the target that shold be provided when the library is provided by the system
|
|
486
|
+
# NOTE: depending on how the dependency is made available, manage_dependency will set the variable ${LIB_NAME}_PROVIDED_TARGET to
|
|
487
|
+
# either TARGET_NAME or TARGET_NAME_SYSTEM, so that ${LIB_NAME}_PROVIDED_TARGET can be used as DEPENDENCY_TARGET in target_link_interface
|
|
488
|
+
)
|
|
489
|
+
set(multiValueArgs
|
|
490
|
+
COMPONENTS # system library components name(s)
|
|
491
|
+
TYPICAL_NAMES # typical names for the dependency to be used with find_library in determining whether a static library is installed
|
|
492
|
+
EXTRA_ARGS
|
|
493
|
+
FIND_PACKAGE_VARIABLES # dependency specific constants to be set for find_package, must be of pattern NAME VALUE NAME VALUE ...
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
497
|
+
|
|
498
|
+
unset( FPC_NAME )
|
|
499
|
+
unset( FPC_VALUE )
|
|
500
|
+
foreach( val IN LISTS ARG_FIND_PACKAGE_VARIABLES )
|
|
501
|
+
if(NOT FPC_NAME)
|
|
502
|
+
set(FPC_NAME ${val})
|
|
503
|
+
else()
|
|
504
|
+
set(FPC_VALUE ${val})
|
|
505
|
+
message( DEBUG "manage_dependency: configuring FIND_PACKAGE_VARIABLES ${FPC_NAME}=${FPC_VALUE}" )
|
|
506
|
+
set(${FPC_NAME}_OLD_VALUE ${${FPC_NAME}}) # save old variable value
|
|
507
|
+
set(${FPC_NAME} ${FPC_VALUE}) # store desired setting
|
|
508
|
+
unset( FPC_NAME )
|
|
509
|
+
unset( FPC_VALUE )
|
|
510
|
+
endif()
|
|
511
|
+
endforeach()
|
|
512
|
+
if(FPC_NAME)
|
|
513
|
+
message( FATAL_ERROR "manage_dependency: argument list for FIND_PACKAGE_VARIABLES requires a value for key ${FPC_NAME}" )
|
|
514
|
+
endif()
|
|
515
|
+
|
|
516
|
+
if(USE_SYSTEM_LIBS AND FORCE_FETCH_ALL)
|
|
517
|
+
message( FATAL_ERROR "manage_dependency: USE_SYSTEM_LIBS and FORCE_FETCH_ALL are mutually exclusive - choose one!" )
|
|
518
|
+
endif()
|
|
519
|
+
|
|
520
|
+
# Initialize return values to defaults
|
|
521
|
+
set(${ARG_LIB_NAME}_FETCHED FALSE PARENT_SCOPE) # assume dependency will be found already installed
|
|
522
|
+
set(${ARG_LIB_NAME}_TARGET_STATIC "" PARENT_SCOPE) # assume no static library found on system
|
|
523
|
+
set(${ARG_LIB_NAME}_PROVIDED_TARGET # this shall should be set to the name provided by a fetched dependency
|
|
524
|
+
${ARG_TARGET_NAME} PARENT_SCOPE) # (to be overridden by TARGET_NAME_SYSTEM if a system library is used)
|
|
525
|
+
set(${ARG_LIB_NAME}_INSTALL_TARGET "" PARENT_SCOPE) # no install target for an already installed dependency
|
|
526
|
+
|
|
527
|
+
set(should_fetch FALSE) # 2026-01-25: default initialization
|
|
528
|
+
|
|
529
|
+
# DEBUG: enable to verify configuration
|
|
530
|
+
# message( STATUS " ++ Prefer static linking over shared libraries: ${PREFER_STATIC}" )
|
|
531
|
+
# message( STATUS " ++ Use system-installed libraries when available: ${USE_SYSTEM_LIBS}" )
|
|
532
|
+
# message( STATUS " ++ Automatically fetch missing dependencies: ${FETCH_DEPS_AUTO}" )
|
|
533
|
+
# message( STATUS " ++ Ignore system libraries and fetch all deps: ${FORCE_FETCH_ALL}" )
|
|
534
|
+
|
|
535
|
+
# Determine search strategy
|
|
536
|
+
if(NOT USE_SYSTEM_LIBS)
|
|
537
|
+
set(should_fetch TRUE)
|
|
538
|
+
else()
|
|
539
|
+
# Try system first
|
|
540
|
+
|
|
541
|
+
# 2026-01-25: test whether components are specified & call find_package accordingly
|
|
542
|
+
set( COMPONENTS_PARAM )
|
|
543
|
+
if( "${ARG_COMPONENTS}" STREQUAL "" )
|
|
544
|
+
message( STATUS "manage_dependency: attempting to find_package ${ARG_PACKAGE_NAME} ${ARG_VERSION} with ${ARG_EXTRA_ARGS} QUIET" )
|
|
545
|
+
else()
|
|
546
|
+
list( APPEND COMPONENTS_PARAM COMPONENTS ${ARG_COMPONENTS} )
|
|
547
|
+
message( STATUS "manage_dependency: attempting to find_package ${ARG_PACKAGE_NAME} ${ARG_VERSION} with ${ARG_EXTRA_ARGS} ${COMPONENTS_PARAM} QUIET" )
|
|
548
|
+
endif()
|
|
549
|
+
|
|
550
|
+
set(DO_TEST_PACKAGE FALSE) # initialize: setting this to TRUE will trigger run_test_package
|
|
551
|
+
set(TRY_FIND_PACKAGE TRUE) # initialize: setting this to TRUE will trigger find_package
|
|
552
|
+
|
|
553
|
+
message( VERBOSE "manage_dependency: PREFER_STATIC is ${PREFER_STATIC}, BUILD_SHARED_LIBS is ${BUILD_SHARED_LIBS}" )
|
|
554
|
+
if(PREFER_STATIC OR BUILD_SHARED_LIBS)
|
|
555
|
+
set(DO_TEST_PACKAGE TRUE) # trigger run_test_package
|
|
556
|
+
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) # save CMAKE_FIND_LIBRARY_SUFFIXES
|
|
557
|
+
endif()
|
|
558
|
+
message( DEBUG "manage_dependency: package ${ARG_PACKAGE_NAME} DO_TEST_PACKAGE is ${DO_TEST_PACKAGE}" )
|
|
559
|
+
|
|
560
|
+
# Only attempt to find_package if desired library has not been determined unavailable before
|
|
561
|
+
if(DO_TEST_PACKAGE)
|
|
562
|
+
|
|
563
|
+
if(PREFER_STATIC)
|
|
564
|
+
set(REQUIRED_LIBRARY_TYPE "STATIC_LIBRARY")
|
|
565
|
+
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a .lib")
|
|
566
|
+
elseif(BUILD_SHARED_LIBS)
|
|
567
|
+
set(REQUIRED_LIBRARY_TYPE "SHARED_LIBRARY")
|
|
568
|
+
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so .dylib .dll .dll.a")
|
|
569
|
+
else() # shouldn't execute
|
|
570
|
+
set(REQUIRED_LIBRARY_TYPE "")
|
|
571
|
+
endif()
|
|
572
|
+
|
|
573
|
+
set(TEMP_SRC_DIR "${CMAKE_BINARY_DIR}/cmake-find-test-${ARG_PACKAGE_NAME}-src")
|
|
574
|
+
file(MAKE_DIRECTORY "${TEMP_SRC_DIR}")
|
|
575
|
+
write_find_test_config(${TEMP_SRC_DIR})
|
|
576
|
+
|
|
577
|
+
set(TEMP_BUILD_DIR "${CMAKE_BINARY_DIR}/cmake-find-test-${ARG_PACKAGE_NAME}-build")
|
|
578
|
+
set(TRY_EXTRA_ARGS ${ARG_EXTRA_ARGS} QUIET)
|
|
579
|
+
|
|
580
|
+
set(RUN_TEST_PACKAGE_ECHO "\"${ARG_PACKAGE_NAME}\" \"${ARG_VERSION}\"")
|
|
581
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${TRY_EXTRA_ARGS}\"")
|
|
582
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${COMPONENTS_PARAM}\"")
|
|
583
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${ARG_TARGET_NAME_SYSTEM}\"")
|
|
584
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${REQUIRED_LIBRARY_TYPE}\"")
|
|
585
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${ARG_FIND_PACKAGE_VARIABLES}\"")
|
|
586
|
+
set(RUN_TEST_PACKAGE_ECHO "${RUN_TEST_PACKAGE_ECHO} \"${CMAKE_FIND_LIBRARY_SUFFIXES}\"")
|
|
587
|
+
|
|
588
|
+
message( STATUS "manage_dependency: run_test_package( ${RUN_TEST_PACKAGE_ECHO} )" )
|
|
589
|
+
run_test_package(
|
|
590
|
+
"${ARG_PACKAGE_NAME}" "${ARG_VERSION}"
|
|
591
|
+
"${TRY_EXTRA_ARGS}"
|
|
592
|
+
"${COMPONENTS_PARAM}"
|
|
593
|
+
"${ARG_TARGET_NAME_SYSTEM}"
|
|
594
|
+
"${REQUIRED_LIBRARY_TYPE}"
|
|
595
|
+
"${ARG_FIND_PACKAGE_VARIABLES}"
|
|
596
|
+
"${CMAKE_FIND_LIBRARY_SUFFIXES}"
|
|
597
|
+
)
|
|
598
|
+
message( DEBUG "manage_dependency: ${ARG_PACKAGE_NAME}_SUITABLE_FOUND is ${${ARG_PACKAGE_NAME}_SUITABLE_FOUND}" )
|
|
599
|
+
|
|
600
|
+
if(NOT ${ARG_PACKAGE_NAME}_SUITABLE_FOUND)
|
|
601
|
+
message( WARNING "manage_dependency: could not find a suitable installed version of ${ARG_PACKAGE_NAME}" )
|
|
602
|
+
set(TRY_FIND_PACKAGE FALSE) # inhibit find_package
|
|
603
|
+
else()
|
|
604
|
+
endif()
|
|
605
|
+
|
|
606
|
+
if(NOT "${TestPackage_LOG_LEVEL}" STREQUAL "DEBUG" ) # disable temporary file deletion in log-level DEBUG to allow inspection
|
|
607
|
+
# Delete temporary folders used to analyze find_package results
|
|
608
|
+
file(REMOVE_RECURSE "${TEMP_SRC_DIR}" "${TEMP_BUILD_DIR}")
|
|
609
|
+
endif()
|
|
610
|
+
endif()
|
|
611
|
+
message( VERBOSE "manage_dependency: package ${ARG_PACKAGE_NAME} TRY_FIND_PACKAGE is ${TRY_FIND_PACKAGE}" )
|
|
612
|
+
|
|
613
|
+
if(TRY_FIND_PACKAGE)
|
|
614
|
+
set(DO_EXTRA_ARGS ${ARG_EXTRA_ARGS} QUIET)
|
|
615
|
+
message( STATUS "manage_dependency: find_package( ${ARG_PACKAGE_NAME} ${ARG_VERSION} ${DO_EXTRA_ARGS} ${COMPONENTS_PARAM} )" )
|
|
616
|
+
find_package(${ARG_PACKAGE_NAME} ${ARG_VERSION}
|
|
617
|
+
${DO_EXTRA_ARGS}
|
|
618
|
+
${COMPONENTS_PARAM}
|
|
619
|
+
# QUIET
|
|
620
|
+
)
|
|
621
|
+
message( VERBOSE "manage_dependency: ${ARG_PACKAGE_NAME}_FOUND is ${${ARG_PACKAGE_NAME}_FOUND}" )
|
|
622
|
+
|
|
623
|
+
# Evaluate find_package result
|
|
624
|
+
if(${ARG_PACKAGE_NAME}_FOUND)
|
|
625
|
+
foreach(component IN LISTS ARG_COMPONENTS)
|
|
626
|
+
string(TOUPPER "${component}" component_upper)
|
|
627
|
+
string(REGEX REPLACE "[^A-Z0-9]" "_" component_upper "${component_upper}")
|
|
628
|
+
message( DEBUG "manage_dependency: COMPONENT is ${component}, upper case is ${component_upper}" )
|
|
629
|
+
set(foundVar "${ARG_PACKAGE_NAME}_${component_upper}_FOUND")
|
|
630
|
+
if(NOT DEFINED ${foundVar} OR NOT ${${foundVar}})
|
|
631
|
+
message( WARNING "Found package ${ARG_PACKAGE_NAME}, but component ${component} is not locally available" )
|
|
632
|
+
unset(${ARG_PACKAGE_NAME}_FOUND) # force attempt to fetch
|
|
633
|
+
endif()
|
|
634
|
+
endforeach()
|
|
635
|
+
if(NOT ${ARG_PACKAGE_NAME}_FOUND)
|
|
636
|
+
message( WARNING "manage_dependency: after call to find_package, the cmake configuration is polluted with settings for ${ARG_PACKAGE_NAME}."
|
|
637
|
+
" An automatic fetch will be attempted but might fail due to that. Install necessary dependencies yourself, if needed" )
|
|
638
|
+
endif()
|
|
639
|
+
endif()
|
|
640
|
+
endif()
|
|
641
|
+
|
|
642
|
+
if(PREFER_STATIC OR BUILD_SHARED_LIBS)
|
|
643
|
+
set(CMAKE_FIND_LIBRARY_SUFFIXES ${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}) # restore CMAKE_FIND_LIBRARY_SUFFIXES
|
|
644
|
+
endif()
|
|
645
|
+
|
|
646
|
+
if(${ARG_PACKAGE_NAME}_FOUND AND TARGET ${ARG_TARGET_NAME_SYSTEM}) # 2026-04-04 check for both package name found and expected target
|
|
647
|
+
if(PREFER_STATIC)
|
|
648
|
+
set(${ARG_LIB_NAME}_TARGET_STATIC "$<TARGET_FILE:${ARG_TARGET_NAME}>" PARENT_SCOPE)
|
|
649
|
+
endif()
|
|
650
|
+
|
|
651
|
+
set(should_fetch FALSE)
|
|
652
|
+
set(${ARG_LIB_NAME}_PROVIDED_TARGET # ${ARG_LIB_NAME}_PROVIDED_TARGET should be the name as provided by an installed library
|
|
653
|
+
${ARG_TARGET_NAME_SYSTEM} PARENT_SCOPE) #
|
|
654
|
+
set(ARG_TARGET_NAME ${ARG_TARGET_NAME_SYSTEM}) # also, the variable ${ARG_TARGET_NAME_SYSTEM}_FOUND will be set to TRUE, so adjust ARG_TARGET_NAME
|
|
655
|
+
message(STATUS "manage_dependency: manage_dependency: Found system ${ARG_LIB_NAME}: ${${ARG_PACKAGE_NAME}_VERSION}")
|
|
656
|
+
else()
|
|
657
|
+
set(should_fetch ${FETCH_DEPS_AUTO}) # BUGFIX 2026-01-25: was previously not evaluating variable FETCH_DEPS_AUTO
|
|
658
|
+
endif()
|
|
659
|
+
endif()
|
|
660
|
+
|
|
661
|
+
# Fetch if needed
|
|
662
|
+
if(should_fetch)
|
|
663
|
+
if( NOT "${ARG_GITHUB_REPO}" STREQUAL "" )
|
|
664
|
+
set( ARG_GIT_REPOSITORY "https://github.com/${ARG_GITHUB_REPO}.git" )
|
|
665
|
+
endif()
|
|
666
|
+
|
|
667
|
+
include(FetchContent)
|
|
668
|
+
|
|
669
|
+
# message( STATUS "FetchContent_Declare_custom(" )
|
|
670
|
+
# message( STATUS " LIB_NAME ${ARG_LIB_NAME}_fetch" )
|
|
671
|
+
# message( STATUS " URL ${ARG_URL}" )
|
|
672
|
+
# message( STATUS " URL_HASH ${ARG_URL_HASH}" )
|
|
673
|
+
# message( STATUS " GIT_REPOSITORY ${ARG_GIT_REPOSITORY}" )
|
|
674
|
+
# message( STATUS " GIT_TAG ${ARG_GIT_TAG}" )
|
|
675
|
+
# message( STATUS " EXCLUDE_FROM_ALL" )
|
|
676
|
+
# message( STATUS ")" )
|
|
677
|
+
FetchContent_Declare_custom(
|
|
678
|
+
LIB_NAME ${ARG_LIB_NAME}_fetch
|
|
679
|
+
URL ${ARG_URL}
|
|
680
|
+
URL_HASH ${ARG_URL_HASH}
|
|
681
|
+
GIT_REPOSITORY ${ARG_GIT_REPOSITORY}
|
|
682
|
+
GIT_TAG ${ARG_GIT_TAG}
|
|
683
|
+
EXCLUDE_FROM_ALL
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
# Set appropriate build type
|
|
687
|
+
if(PREFER_STATIC)
|
|
688
|
+
set(${ARG_LIB_NAME}_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
689
|
+
else()
|
|
690
|
+
set(${ARG_LIB_NAME}_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
|
|
691
|
+
endif()
|
|
692
|
+
|
|
693
|
+
# Make available but don't build yet
|
|
694
|
+
FetchContent_MakeAvailable_custom(
|
|
695
|
+
LIB_NAME ${ARG_LIB_NAME}_fetch
|
|
696
|
+
EXCLUDE_FROM_ALL
|
|
697
|
+
)
|
|
698
|
+
|
|
699
|
+
if(PREFER_STATIC)
|
|
700
|
+
# set return value for path to static library, if any
|
|
701
|
+
set(${ARG_LIB_NAME}_TARGET_STATIC "$<TARGET_FILE:${ARG_TARGET_NAME}>" PARENT_SCOPE)
|
|
702
|
+
endif()
|
|
703
|
+
set(${ARG_LIB_NAME}_FETCHED TRUE PARENT_SCOPE) # set return value indicating the dependency was fetched from source repository
|
|
704
|
+
endif()
|
|
705
|
+
|
|
706
|
+
# Verify target exists
|
|
707
|
+
if(NOT TARGET "${ARG_TARGET_NAME}")
|
|
708
|
+
message(FATAL_ERROR
|
|
709
|
+
"manage_dependency: Dependency ${ARG_LIB_NAME} (target ${ARG_TARGET_NAME}) not available. "
|
|
710
|
+
"Check your system installation or enable FETCH_DEPS_AUTO."
|
|
711
|
+
)
|
|
712
|
+
else() # target exists
|
|
713
|
+
get_target_property(TARGET_IS_IMPORTED "${ARG_TARGET_NAME}" IMPORTED)
|
|
714
|
+
if(TARGET_IS_IMPORTED)
|
|
715
|
+
message( DEBUG "manage_dependency: target ${ARG_TARGET_NAME} is imported" )
|
|
716
|
+
set(${ARG_LIB_NAME}_INSTALL_TARGET "" PARENT_SCOPE) # imported targets do not need to be installed
|
|
717
|
+
else()
|
|
718
|
+
message( DEBUG "manage_dependency: target ${ARG_TARGET_NAME} is not imported and must be installed" )
|
|
719
|
+
# unfortunately, ARG_TARGET_NAME can be an alias, which does not behave well with cmake install
|
|
720
|
+
# so: get the aliased target, if any
|
|
721
|
+
get_target_property(ALIASED_INSTALL_TARGET "${ARG_TARGET_NAME}" ALIASED_TARGET)
|
|
722
|
+
if(ALIASED_INSTALL_TARGET)
|
|
723
|
+
message( STATUS "manage_dependency: target ${ARG_TARGET_NAME} is an alias, resolved to ${ALIASED_INSTALL_TARGET}" )
|
|
724
|
+
set(${ARG_LIB_NAME}_INSTALL_TARGET "${ALIASED_INSTALL_TARGET}" PARENT_SCOPE)
|
|
725
|
+
else()
|
|
726
|
+
message( DEBUG "manage_dependency: target ${ARG_TARGET_NAME} is already the final target" )
|
|
727
|
+
set(${ARG_LIB_NAME}_INSTALL_TARGET "${ARG_TARGET_NAME}" PARENT_SCOPE)
|
|
728
|
+
endif()
|
|
729
|
+
|
|
730
|
+
endif()
|
|
731
|
+
endif()
|
|
732
|
+
|
|
733
|
+
# restore saved values of FIND_PACKAGE_VARIABLES - FPC_NAME and FPC_VALUE are still expected to be unset when execution gets here
|
|
734
|
+
foreach( val IN LISTS ARG_FIND_PACKAGE_VARIABLES )
|
|
735
|
+
if(NOT FPC_NAME)
|
|
736
|
+
set(FPC_NAME ${val})
|
|
737
|
+
else()
|
|
738
|
+
set(FPC_VALUE ${val})
|
|
739
|
+
set(${FPC_NAME} ${${FPC_NAME}_OLD_VALUE}) # restore original value
|
|
740
|
+
message( DEBUG "manage_dependency: restoring FIND_PACKAGE_VARIABLES ${FPC_NAME}=${${FPC_NAME}}" )
|
|
741
|
+
unset( FPC_NAME )
|
|
742
|
+
unset( FPC_VALUE )
|
|
743
|
+
endif()
|
|
744
|
+
endforeach()
|
|
745
|
+
endfunction()
|
|
746
|
+
# End of Function: manage_dependency
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
# Function: target_link_interface
|
|
750
|
+
# Purpose: link an interface library that does not inherit an install target from dependency
|
|
751
|
+
# Author: Lars Uffmann (coding23@uffmann.name)
|
|
752
|
+
# NOTE: INTERFACE_NAME has to be included in install TARGETS by the caller
|
|
753
|
+
function(target_link_interface)
|
|
754
|
+
set(options PUBLIC PRIVATE) # one option must be explicitly indicated:
|
|
755
|
+
# # PRIVATE: users of ${ARG_INTERFACE_NAME} shall not use features of ${ARG_DEPENDENCY_ALIAS}
|
|
756
|
+
# # PUBLIC: users of ${ARG_INTERFACE_NAME} may use features of ${ARG_DEPENDENCY_ALIAS}
|
|
757
|
+
set(oneValueArgs
|
|
758
|
+
LIB_NAME # the library that shall be linked versus an interface to dependency
|
|
759
|
+
INTERFACE_NAME # name of the interface library to be created (will be needed by caller in install targets)
|
|
760
|
+
DEPENDENCY_ALIAS # the name (can be alias) of the actual underlying dependency
|
|
761
|
+
DEPENDENCY_TARGET # the name (not alias) of the underlying dependency
|
|
762
|
+
)
|
|
763
|
+
set(multiValueArgs EXTRA_ARGS)
|
|
764
|
+
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
765
|
+
|
|
766
|
+
if(ARG_PUBLIC AND ARG_PRIVATE)
|
|
767
|
+
message( FATAL_ERROR "target_link_interface: flags PUBLIC and PRIVATE are mutually exclusive")
|
|
768
|
+
endif()
|
|
769
|
+
if(NOT (ARG_PUBLIC OR ARG_PRIVATE))
|
|
770
|
+
message( FATAL_ERROR "target_link_interface: PUBLIC or PRIVATE must be specified")
|
|
771
|
+
endif()
|
|
772
|
+
|
|
773
|
+
# Ridiculous workaround part 1: Define an IMPORTED library to properly inherit INTERFACE_INCLUDE_DIRECTORIES from DEPENDENCY_NAME
|
|
774
|
+
set(IMPORTED_NAME "${ARG_INTERFACE_NAME}_imported") # NOTE: this name is assumed to be unique within project
|
|
775
|
+
add_library(${IMPORTED_NAME} STATIC IMPORTED)
|
|
776
|
+
set_target_properties(${IMPORTED_NAME} PROPERTIES
|
|
777
|
+
# What we do not care about: imported location
|
|
778
|
+
# IMPORTED_LOCATION "" # using a FAKE target that exists, the imported library can be used to fetch nowide INTERFACE_INCLUDE_DIRECTORIES
|
|
779
|
+
# to omit the requirement for this fake target, a second abstraction level via Ridiculous workaround part 2 is needed
|
|
780
|
+
|
|
781
|
+
# What we are actually interested in: interface include directories and compile definitions
|
|
782
|
+
INTERFACE_INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:${ARG_DEPENDENCY_ALIAS},INTERFACE_INCLUDE_DIRECTORIES>"
|
|
783
|
+
INTERFACE_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${ARG_DEPENDENCY_ALIAS},INTERFACE_COMPILE_DEFINITIONS>"
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
# Ridiculous workaround part 2: Define an INTERFACE library to the IMPORTED ${IMPORTED_NAME}, while eliminating the need for an IMPORTED_LOCATION
|
|
787
|
+
add_library(${ARG_INTERFACE_NAME} INTERFACE)
|
|
788
|
+
# NOTE: INTERFACE_NAME will expose INTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_DEFINITIONS of DEPENDENCY_ALIAS via the IMPORTED library
|
|
789
|
+
target_include_directories(${ARG_INTERFACE_NAME} INTERFACE $<TARGET_PROPERTY:${IMPORTED_NAME},INTERFACE_INCLUDE_DIRECTORIES> )
|
|
790
|
+
target_compile_definitions(${ARG_INTERFACE_NAME} INTERFACE $<TARGET_PROPERTY:${IMPORTED_NAME},INTERFACE_COMPILE_DEFINITIONS> )
|
|
791
|
+
# CAUTION: do *NOT* use target_link_libraries to link to the IMPORTED library, this would re-activate the need for an IMPORTED_LOCATION
|
|
792
|
+
|
|
793
|
+
# Ridiculous workaround part 3: Link LIB_NAME against the INTERFACE library
|
|
794
|
+
if(ARG_PUBLIC)
|
|
795
|
+
set( ARG_PRIVACY "PUBLIC" )
|
|
796
|
+
else()
|
|
797
|
+
set( ARG_PRIVACY "PRIVATE" ) # begin of function has asserted that either ARG_PUBLIC or ARG_PRIVATE must be true
|
|
798
|
+
endif()
|
|
799
|
+
target_link_libraries(${ARG_LIB_NAME}
|
|
800
|
+
${ARG_PRIVACY} # PRIVATE means users of ${ARG_INTERFACE_NAME} shall not use features of ${ARG_DEPENDENCY_ALIAS}
|
|
801
|
+
${ARG_INTERFACE_NAME} # this links INTERFACE_INCLUDE_DIRECTORIES
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
# Ridiculous workaround part 4: link to the built archive file so that ARG_LIB_NAME does not require DEPENDENCY_TARGET to be in the export set
|
|
805
|
+
target_link_libraries(${ARG_LIB_NAME}
|
|
806
|
+
${ARG_PRIVACY} # TBD: would always PRIVATE mangle symbols so that users can not access them from the static LIB_NAME?
|
|
807
|
+
$<TARGET_FILE:${ARG_DEPENDENCY_TARGET}>
|
|
808
|
+
)
|
|
809
|
+
|
|
810
|
+
# Ridiculous workaround part 5: ensure DEPENDENCY_ALIAS is built before LIB_NAME (so that archive exists at link time)
|
|
811
|
+
add_dependencies(${ARG_LIB_NAME} ${ARG_DEPENDENCY_ALIAS})
|
|
812
|
+
endfunction()
|
|
813
|
+
# End of Function: target_link_interface
|