From a0cc5cf420669d65298a15c656f22ce15b5489c4 Mon Sep 17 00:00:00 2001 From: francis Date: Wed, 26 Nov 2025 12:45:37 +0000 Subject: [PATCH 1/2] Allow users to have an untracked CMakeUserPresets.json file. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9b4696c85..64b461df3 100644 --- a/.gitignore +++ b/.gitignore @@ -350,4 +350,4 @@ Examples/**/pricingstats.csv *.fls .gitmodules - +CMakeUserPresets.json From a8e98c40af1cb6dc085946c63f746c09ddeebb98 Mon Sep 17 00:00:00 2001 From: francis Date: Wed, 26 Nov 2025 15:24:03 +0000 Subject: [PATCH 2/2] Add Boost libraries missing in link step. When find_package uses config search mode for Boost instead of the old module search mode, there are Boost libraries missing in the link step: - Boost::log_setup missing for QLE and ORED test suites. - Boost::regex missing in ORE-SWIG build. To build using the CMake config file provided by Boost, you do not create the BOOST and BOOST_LIB64 environment variables and hence BOOST_INCLUDEDIR and BOOST_LIBRARYDIR are not set in the presets. You instead supply the path to BoostConfig.cmake in the variable Boost_DIR. Also, if you are using CMake 3.30 and above, you should set the variable CMAKE_POLICY_DEFAULT_CMP0167 to NEW to avoid warnings about the policy not being set. This issue is not apparent when you create the BOOST and BOOST_LIB64 environment variables because CMake uses the module mode search and the CMake FindBoost.cmake module has entries of the form: set(_Boost_LOG_DEPENDENCIES log_setup regex ...) so the dependencies on log_setup and regex are pulled in. Note: to see the difference in the link commands, you need to keep the .rsp files that are used to store the .obj and .lib file arguments. If building with Ninja, you can do this by passing `-d keeprsp` to the build step. From command line, something like this for example: cmake --build --preset=windows-ninja-x64-debug --target quantext-test-suite.exe --verbose -- -d keeprsp or if you want to add it to the preset file for VS to pick up: "nativeToolOptions": [ "-d keeprsp" ] --- ORE-SWIG/CMakeLists.txt | 2 +- OREData/CMakeLists.txt | 2 +- QuantExt/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ORE-SWIG/CMakeLists.txt b/ORE-SWIG/CMakeLists.txt index 377c81000..f909fbcf4 100644 --- a/ORE-SWIG/CMakeLists.txt +++ b/ORE-SWIG/CMakeLists.txt @@ -32,7 +32,7 @@ get_library_name("QuantExt" QLE_LIB_NAME) set_ql_library_name() # To build the module, we moreover need Boost, Swig, Python -set(BOOST_COMPONENT_LIST serialization date_time filesystem timer thread log) +set(BOOST_COMPONENT_LIST serialization date_time filesystem timer thread log regex) if(ORE_USE_ZLIB) diff --git a/OREData/CMakeLists.txt b/OREData/CMakeLists.txt index acfb5aa80..5d866dea7 100644 --- a/OREData/CMakeLists.txt +++ b/OREData/CMakeLists.txt @@ -14,7 +14,7 @@ else() SET(COMPONENTS_CONDITIONAL "") endif() -find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} date_time thread serialization timer log filesystem OPTIONAL_COMPONENTS system chrono) +find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} date_time thread serialization timer log_setup log filesystem OPTIONAL_COMPONENTS system chrono) include_directories(${Boost_INCLUDE_DIRS}) diff --git a/QuantExt/CMakeLists.txt b/QuantExt/CMakeLists.txt index 78253c3e1..e0bce3463 100644 --- a/QuantExt/CMakeLists.txt +++ b/QuantExt/CMakeLists.txt @@ -14,7 +14,7 @@ else() endif() -find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} date_time thread serialization timer log filesystem OPTIONAL_COMPONENTS system chrono) +find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} date_time thread serialization timer log_setup log filesystem OPTIONAL_COMPONENTS system chrono) if (ORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER AND UNIX AND NOT APPLE)