【发布时间】:2015-09-10 16:33:51
【问题描述】:
这是 Makefile 中的 CFLAGS。
CFLAGS = -I/usr/include/libglade-2.0 -I/usr/include/gsl `pkg-config --cflags --libs gtk+-2.0` -lglade-2.0 -lglut -I/usr/local/include/dc1394 -ldc1394
我想使用 CMAKE 而不是 Makefile。这部分是我写的CMakeLists.txt文件。
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED "gtk+-2.0")
# Add the path to its header files to the compiler command line
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
# Add any compiler flags it requires
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GTK_CFLAGS}")
# Add the makefile target for your executable and link in the GTK library
target_link_libraries(${CMAKE_PROJECT_NAME} ${GTK_LIBRARIES})
# gtk and glade
find_package(GTK2 2.10 REQUIRED gtk glade)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${GTK2_LIBRARIES})
endif()
我的问题是如何结合
`pkg-config --cflags --libs gtk+-2.0`
在 CXX_FLAGS 中。我搜索了很多,但找不到答案。请帮忙。
【问题讨论】:
标签: c++ cmake pkg-config