User Tools

Site Tools




To use custom FindPackage modules: Set CMAKE_MODULE_PATH to tell where your Find<package>.cmake files are located.

Useful tips

If the module name is FindLibMyLib.cmake, following variable will be defined when inside the script: LibMyLib_FIND_REQUIRED LibMyLib_FIND_QUIETLY

Caution: this variable is case-sensitive!

Big project architecture

Always use target_compile_definitions, target_link_libraries,

Writing FindPackage.cmake

Good practices on Linux:

  1. Use PkgConfig module to use pkg-config util under Linux.
  2. Use find_library on paths found by pkg-config.
  3. Use FindPackageHandleStandardArgs for handling QUIET and REQUIRED arguments.
cmake.txt · Last modified: 2016/09/26 11:44 by louisbob_ext