Command line equivalent of cmake's find_package?

前端 未结 1 1746
渐次进展
渐次进展 2021-02-01 07:27

I\'m debugging a cmake file which fails to find certain packages (using find_package()). What does find_package() actually do when it searches for pack

相关标签:
1条回答
  • 2021-02-01 08:00

    1. What find_package does:

    From the documentation of find_package():

    CMake searches for a file called Find.cmake in the CMAKE_MODULE_PATH followed by the CMake installation. If the file is found, it is read and processed by CMake.

    On Linux, the default scripts usually are located here:

    ls /usr/share/cmake*/Modules/Find*.cmake
    

    2. How to use find_package on the command-line:

    # cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=EXIST
    Boost found
    
    # cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE
    -I/usr/include
    
    # cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK
       -rdynamic
    
    0 讨论(0)
提交回复
热议问题