|
From: Jonathan S. <sw...@gm...> - 2021-10-20 22:21:55
|
Hi Peter, In your project’s CMakeLists.txt file you can use target_include_directories[1] to tell cmake where to find the headers, and target_link_directories[2] to tell cmake where to find the libraries for linking. Having said that, you should probably think about using a package manager such as vcpkg to handle this kind of setup for you automatically. Lastly, you mentioned that you created a .lib file but you seem to be using make on Linux, which means you need to link against libQuantLib.a instead. [1] https://cmake.org/cmake/help/latest/command/target_include_directories.html [2] https://cmake.org/cmake/help/latest/command/target_link_directories.html 2021년 10월 21일 (목) 05:48, Peter Ye <pet...@gm...>님이 작성: > Hi Quantlib Team, > > I am new to using CMakeLists and have been running into issues with > linking the Quantlib library for a build. I have been successful with > generating a .lib file as instructed on the Quantlib website, but I am > completely lost in linking the Quantlib library to CMakeLists. According to > my terminal, it states that I built the header, object, and cpp files; > however, I cannot include the ql directory within my source code. Here is > the error message: > > fatal error: ql/math/matrix.h: No such file or directory > #include <ql/math/matrix.h> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > compilation terminated. > CMakeFiles/Analytical_Metrics.dir/build.make:75: recipe for target > 'CMakeFiles/Analytical_Metrics.dir/src/main.cpp.o' failed > make[2]: *** [CMakeFiles/Analytical_Metrics.dir/src/main.cpp.o] Error 1 > CMakeFiles/Makefile2:567: recipe for target > 'CMakeFiles/Analytical_Metrics.dir/all' failed > make[1]: *** [CMakeFiles/Analytical_Metrics.dir/all] Error 2 > Makefile:165: recipe for target 'all' failed > make: *** [all] Error 2 > > I am not sure if this was already answered, but I would truly appreciate > it if you can provide me with guidance or an example on how to go about > using Quantlib with CMakeLists. I have been stuck on this for weeks. > > Best Regards, > > Peter Ye > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |