I prefer this approach, since you could decide to go with C++20 during configuration. Is not an exact equivalent for setting the C++ standard, but rather provides a lower bound that could be overwritten by setting CMAKE_CXX_STANDARD as a cache variable during configuration. target_compile_features(untitled1 PRIVATE cxx_std_17) link_libraries(untitled1 aa_lib) only applies to cmake targets created specified after the cmake command and it would also try to link untitled1 to such a target. Target_link_libraries(untitled1 PRIVATE aa) # add the following list of libraries to the libraries linked to target untitled1: Target_compile_features(untitled1 PRIVATE cxx_std_17) # specify a target specific minimum here instead of globablly specifying the choice This means you should be able to link the library using the following CMakeLists.txt file: cmake_minimum_required(VERSION 3.25) Furthermore based on this we can tell that the name of the library to provide to the linker is aa. usr/lib/x86_64-linux-gnu is searched by default by the linker for libraries, so specifying the full library path or additional link directories is not necessary. The shared library is installed at /usr/lib/x86_64-linux-gnu/libaa.so. LIB runs in this mode when you do not specify /EXTRACT (to copy an object to a file) or /DEF (to. The default mode for LIB is to build or modify a library of COFF objects. The header file is installed at /usr/include/aalib.h /usr/include should be part of the default include dirs, so we don't need to adjust the include dirs. How can I link a static library with cmake The library Im trying to link is in the project directory lib/lib.a and the only source file is main.cpp. There are several options, and the simplest appears to be lib /list sqlite3.lib, which should list objects for a static library and produce no output for the import library. This prevents the use of find_package, at least without writing one on your own find script/package configuration file. Given the list of files in the libaa1 package we can make the following observations: Provides a separate development package or SDK, be sure it has been "aa_lib_DIR" to a directory containing one of the above files. Returns CMake Error at CMakeLists.txt:8 (find_package):īy not providing "Findaa_lib.cmake" in CMAKE_MODULE_PATH this project hasĪsked CMake to find a package configuration file provided by "aa_lib", butĬould not find a package configuration file provided by "aa_lib" with anyĪdd the installation prefix of "aa_lib" to CMAKE_PREFIX_PATH or set I installed aalib through add-apt-repository ppa:aalib & apt install libaa1 libaa1-dev libaa-bin. This is my first time using CMake, and I can't get aalib working. addlibrary STATIC STATIC addlibrary (xlog xlog.cpp) cmake STATIC SHARED addlibrary (xlog SHARED xlog.cpp) LinuxWindows declspec (dllexport)lib CMakeLists.txt cmake -S. I'm trying to link aalib to my cmake executable, and can't get it working.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |