From Cute Lemur, 2 Months ago, written in Plain Text.
Embed
  1. cmake_minimum_required(VERSION 2.8)
  2. project(StandaloneFileBrowser C)
  3.  
  4. set(CMAKE_C_STANDARD 11)
  5.  
  6. # Use the package PkgConfig to detect GTK+ headers/library files
  7. FIND_PACKAGE(PkgConfig REQUIRED)
  8. PKG_CHECK_MODULES(GTK2 REQUIRED gtk+-2.0)
  9.  
  10. # Setup CMake to use GTK+, tell the compiler where to look for headers
  11. # and to the linker where to look for libraries
  12. INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
  13. LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
  14.  
  15. # Add other flags to the compiler
  16. ADD_DEFINITIONS(${GTK2_CFLAGS_OTHER})
  17.  
  18. add_library(${PROJECT_NAME} SHARED library.c library.h)
  19.  
  20. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK2_LIBRARIES})
  21.  
  22. add_executable(${PROJECT_NAME}_EXE main.c)
  23.  
  24. TARGET_LINK_LIBRARIES(${PROJECT_NAME}_EXE ${PROJECT_NAME} ${GTK2_LIBRARIES})