Skip to content

Instantly share code, notes, and snippets.

@januswel
Created June 21, 2015 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save januswel/15e708d7c2e95a543963 to your computer and use it in GitHub Desktop.
Save januswel/15e708d7c2e95a543963 to your computer and use it in GitHub Desktop.
CMake で pkg-config を使う ref: http://qiita.com/janus_wel/items/e70695670c22a0331451
# load the module to use pkg-config
find_package(PkgConfig)
# search library with pkg-config and name its results "LIBSAMPLE"
pkg_check_modules(LIBSAMPLE REQUIRED libsample)
# use the variable <RESULTNAME>_INCLUDE_DIRS to get include paths
include_directories(${LIBSAMPLE_INCLUDE_DIRS})
add_executable(sample
main.cpp
)
# use the variable <RESULTNAME>_LIBRARIES to get library paths
target_link_libraries(sample
${LIBSAMPLE_LIBRARIES}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment