Created
January 3, 2019 13:56
-
-
Save kokobd/552d994633f9c2a0bd0d5c7a8f8b35f4 to your computer and use it in GitHub Desktop.
Find module for GTK3
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 3.13) | |
project(gtk_demo C) | |
set(CMAKE_C_STANDARD 99) | |
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) | |
find_package(GTK3 REQUIRED) | |
add_executable(gtk_demo | |
src/main.c | |
) | |
target_link_libraries(gtk_demo | |
PRIVATE gtk::gtk | |
) |
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
find_package(PkgConfig REQUIRED) | |
pkg_check_modules(PC_gtk REQUIRED gtk+-3.0) | |
include(FindPackageHandleStandardArgs) | |
find_package_handle_standard_args(GTK3 | |
REQUIRED_VARS PC_gtk_FOUND | |
) | |
if (GTK3_FOUND) | |
add_library(gtk::gtk INTERFACE IMPORTED) | |
target_link_directories(gtk::gtk | |
INTERFACE ${PC_gtk_LIBRARY_DIRS} | |
) | |
target_include_directories(gtk::gtk | |
INTERFACE ${PC_gtk_INCLUDE_DIRS} | |
) | |
target_link_libraries(gtk::gtk | |
INTERFACE ${PC_gtk_LIBRARIES} | |
) | |
target_compile_options(gtk::gtk | |
INTERFACE ${PC_gtk_CFLAGS_OTHER} | |
) | |
endif () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment