o*****l 发帖数: 539 | 1 How to include a library using cmake?
======================================
For example, I want to use glib2,
Install:
$ sudo yum install glib2-devel
Then in cpp file,
#include
compile:
g++ `pkg-config --cflags --libs glib-2.0` test.cpp
======================================================
How to do it using cmake?
Thanks! | o*****l 发帖数: 539 | 2 solved, add this line:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/glib-2.0 -I/usr/lib64
/glib-2.0/include -lglib-2.0")
【在 o*****l 的大作中提到】 : How to include a library using cmake? : ====================================== : For example, I want to use glib2, : Install: : $ sudo yum install glib2-devel : Then in cpp file, : #include : compile: : g++ `pkg-config --cflags --libs glib-2.0` test.cpp : ======================================================
| s******u 发帖数: 501 | 3 include_directories(
/usr/include/glib-2.0
/usr/lib64/glib-2.0/include
)
link_directories(
)
add_executable(xx aa.cc bb.cc)
target_link_libraries(xx glib-2.0)
lib64
【在 o*****l 的大作中提到】 : solved, add this line: : SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/glib-2.0 -I/usr/lib64 : /glib-2.0/include -lglib-2.0")
|
|