|
From: Jonathan S. <sw...@gm...> - 2022-01-20 12:44:12
|
I took a quick look at your CMakeLists.txt file and fixed it up here: https://gist.github.com/sweemer/dff4b0294eff698a3d670811549d3c35 For my gist to work you'll need to download the latest version 1.25 of QuantLib. The gist may not work perfectly but it should be a good starting point. You will want to spend some time to review the CMake documentation[1] for how to set the include and link properties for your project as there are many more details that cannot be covered here. As far as CLion is concerned, I'm not sure how to get it working, but based on the blog link that you shared, the first step seems to be to tell CMake to configure your build with the correct compiler[2]. [1] https://cmake.org/cmake/help/latest/module/FindBoost.html#examples [2] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html On Thu, Jan 20, 2022 at 1:33 PM <chi...@ya...> wrote: > Hi Jonathan > > > > Thank you for your kind advice. I already have inserted the macros below. > Based on Luigi’s reply, it seems the Boost headers alone are sufficient (if > I am not building the test-libraries) and that’s works fine for me in CLion > as well. So now my focus is to build Quantlib using mingw in CLion. > > > > Can you please recommend how I can modify the existing CMake file to build > Quantlib using CMake ? > > > > i) Do I modify the existing CMakeLists.txt file that comes > with Quantlib with recommendations from Dimitri’s blog ? Or write a new > CMake file ? > > > > https://blog.jetbrains.com/clion/2015/12/quantlib-clion/ > > > > > > > > Option 2: (since everything works fine in Visual Studio, I thought of > trying my luck) > > > > I switched the compiler itself in CLion from my default mingw to Visual > Studio 2017. I then modified the CMakeLists.txt file(which is attached in > this email) but it doesn’t work > > as in the main.cpp the #include <ql/quantlib.hpp> can’t find it > > > > fatal error C1083: Cannot open include file: 'ql/quantlib.hpp': No such > file or directory > > NMAKE : fatal error U1077: > 'C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\cl.exe' > : return code '0x2' > > Stop. > > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' > : return code '0x2' > > Stop > > > > Thank you for your kind help > > > > > > > > *From:* Jonathan Sweemer <sw...@gm...> > *Sent:* Wednesday, January 19, 2022 8:34 PM > *To:* Chirag Desai <chi...@ya...> > *Cc:* qua...@li... > *Subject:* Re: [Quantlib-users] Quantlib in CLion > > > > Hi Chirag, > > > > The first step is to successfully build Boost using a toolchain compatible > with CLion. I have never done this before but the StackOverflow link you > pasted seems to provide reasonable instructions. > > > > Once you have built Boost, then you can use the BOOST_INCLUDEDIR, > BOOST_LIBRARY_DIR, and/or BOOST_ROOT variables to tell CMake where to > find the Boost installation when configuring QuantLib. See [1] for more > details on these variables. > > > > Regarding whether a header-only Boost installation is sufficient, > unfortunately no, QuantLib still depends on some pre-compiled Boost > libraries, but this may change in the future. See [2] for the latest list > of Boost library dependencies. > > > > [1] https://cmake.org/cmake/help/latest/module/FindBoost.html > > [2] https://github.com/lballabio/QuantLib/blob/master/CMakeLists.txt#L118 > > > > > > > > On Wed, Jan 19, 2022 at 8:16 PM Chirag Desai via QuantLib-users < > qua...@li...> wrote: > > Hi Quantlib Users > > > > Hope all is well. I am trying to get more involved in the Quantlib project > with my interest in quantitative finance. > > > > I have been able to get it to work in Windows VS2017 but I am trying to > make it work in CLion using CMake with no success. > > > > 1) I can't even get Boost to compile in CLion using CMake. I am only able > to use the header only Boost files in CLion > > > > https://stackoverflow.com/questions/36519453/setup-boost-in-clion > > > > 2) I tried following this blog by Dimitry but I guess I first need to make > Boost work (or are the header only Boost files sufficient ?). The > instructions are not very clear. > > > > https://blog.jetbrains.com/clion/2015/12/quantlib-clion/ > > > > May I kindly check if this is something somebody can guide me on please ? > > > > Thank you for your guidance > > Chirag > > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > |