If I substitute add_library() with add_executable() I get the same error. The named must have been created in the current directory by a command such as add_executable() or add_library(). This can be set when configuring CMake or put into a CMake toolchain file. so file? The docs say the following about target_link_libraries(): The compiler for CMake can be set using either the CMAKECCOMPILER and CMAKECXXCOMPILER variable or using the CC and CXX environment variables. It seems that source files (.c, cpp, etc) are absolutely required when linking in a library. If I comment out the add_library line, I get the following: CMake Error at CMakeLists.txt:51 (target_link_libraries):Ĭannot specify link libraries for target "testlib" which is not built by this project. hppĬMake Error: CMake can not determine linker language for target: testlib See the cmake-buildsystem(7) manual for more on defining buildsystem properties. It will display the path of the library found by CMake: It will display the path of the library found by CMake: You can double-check that the program produced by CMake no longer has a dependency on libsqlite3. See the cmake-generator-expressions(7) manual for available expressions. Variables in conanbuildinfo.cmake¶ Package declared variables: For each requirement conanbuildinfo.cmake file declares the following variables. Step to the targetlinklibraries() line and check the sqlite3 variable. Note however, that generator expressions will not be used in OLD handling of CMP0003 or CMP0004. Target_link_libraries(testlib libtest-lib.so)Īs above, I get the following error: CMake Error at CMakeLists.txt:49 (add_library): Arguments to targetlinklibraries may use generator expressions with the syntax <.>.This is what I have at the bottom of my CMakeLists.txt: link_directories("/projectspath/LinkTest/TestLib/app/build/intermediates/cmake/debug/obj/armeabi-v7a") Then, using settargetproperties() you can set required INTERFACEXXX properties for it. You can check whether the target a already exists before calling add. See also: addsubdirectory findpackage Git submodules CMake and using git-submodule for dependence projects. I'm trying to link in a pre-compiled shared library file called libtest-lib.so. You can use addlibrary() and tell that it actually imported. targetlinklibraries(A PUBLIC B) Also note that each of A, B and RootProject must have a top level CMakeLists.txt in order for addsubdirectory to work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |