Created
July 18, 2012 17:58
-
-
Save yuya-oc/3137761 to your computer and use it in GitHub Desktop.
cmake with pkg-config libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8) | |
project(pkg) | |
include(FindPkgConfig) | |
pkg_check_modules(<PREFIX> REQUIRED <lib_name>) | |
if(<PREFIX>_FOUND) | |
message(STATUS "<PREFIX> is found:") | |
message(STATUS " <PREFIX>_INCLUDE_DIRS= ${<PREFIX>_INCLUDE_DIRS}") | |
message(STATUS " <PREFIX>_LIBRARIES= ${<PREFIX>_LIBRARIES}") | |
message(STATUS " <PREFIX>_LIBRARY_DIRS= ${<PREFIX>_LIBRARY_DIRS}") | |
link_directories(${<PREFIX>_LIBRARY_DIRS}) | |
include_directories(${<PREFIX>_INCLUDE_DIRS}) | |
end() | |
add_executable(pkg | |
main.cpp | |
) | |
target_link_libraries(pkg ${<PREFIX>_LIBRARIES}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment