add_library(foo Foo.hpp Foo.cpp)install(FILES Foo.hpp DESTINATION include)install(TARGETS foo DESTINATION lib)install(FILES FooConfig.cmake DESTINATION lib/cmake/Foo) Simplified version of config file: $catFooConfig.cmake add_library(foo STATIC IMPORTED) find_library(FOO_LIBRARY_PATH foo HINTS"...
# FindJPEG.cmakefind_path(JPEG_INCLUDE_DIRjpeglib.h)set(JPEG_NAMES${JPEG_NAMES}jpeg libjpeg)find_library(JPEG_LIBRARYNAMES${JPEG_NAMES})... 所以如果想要指定优先使用静态库,前面的cmake脚本可以稍改一下,如下,就是在调用find_package之前设置JPEG_NAMES为想要的静态库名: 代码语言:javascript 复制 # ...
$ cat FooConfig.cmake add_library(foo STATIC IMPORTED) find_library(FOO_LIBRARY_PATH foo HINTS "${CMAKE_CURRENT_LIST_DIR}/../../") set_target_properties(foo PROPERTIES IMPORTED_LOCATION "${FOO_LIBRARY_PATH}") 1. 2. 3. 4. By default project installed inCMAKE_INSTALL_PREFIXdirectory: ...
想让cmake找到boost,需要在环境变量中定义BOOST_ROOT的值。 在CMakeLists.txt中这样写。 set(Boost_USE_STATIC_LIBS ON)set(Boost_USE_MULTITHREADED ON)find_package(Boost1.73.0REQUIRED)target_include_directories(Experiments PUBLIC ${Boost_INCLUDE_DIRS})target_link_directories(Experiments PUBLIC ${Boost_LIB...
find_path(CURL_INCLUDE_DIRNAMEScurl/curl.h)mark_as_advanced(CURL_INCLUDE_DIR)# Lookforthelibrary(sorted from most current/relevant entry to least).find_library(CURL_LIBRARYNAMEScurl # WindowsMSVCprebuilts:curllib libcurl_imp curllib_static ...
add_library(test_installSTATICsrc/test_install.cpp) 把我们之前写的源文件做成一个名叫test_install的库文件。这里有一个名叫STATIC的标志,表明我们建立的这个库文件是静态库。如果我们想建立动态库,则要用SHARED代替STATIC。静态库和动态库的区别见我之前的文章 ...
add_library(${PROJECT_NAME} STATIC ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} PRIVATE protocol smt-logger smt-timer baumer tucsen opencv) target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> ...
add_library(mxnet STATIC IMPORTED) set_property(TARGET mxnet PROPERTY IMPORTED_LOCATION /path/to/libmxnet.a) target_link_libraries(project_name mxnet ) #添加libmxnet.a #声明要求的 cmake 最低版本 cmake_minimum_required( VERSION 2.8 )
CMAKE_STATIC_LIBRARY_PREFIX IT IS:find_package(ZLIB REQUIRED) This seems to me like the 'lib' prefix is incorrectly applied inside vcpkg cmake module for zlib. give a --trace-expand log if that doesn't fix it IT IS: find_package(ZLIB REQUIRED) ...
Currently, Nalu's top-level CMakeLists.txt sets SET(CMAKE_FIND_LIBRARY_PREFIXES lib) SET(CMAKE_FIND_LIBRARY_SUFFIXES a) which forces CMake to only look for static libraries with find_package directives. Is there a use case where this is ...