cmake_minimum_required(VERSION 3.17) project(cpp_only_threads) set(CMAKE_C) # These are where the include files should be include_directories(/usr/local/include) macro(print_all_variables) message(STATUS "print_all_variables------------------------------------------{") get_cmake_property(_variableNames VARIABLES) foreach (_variableName ${_variableNames}) message(STATUS "${_variableName}=${${_variableName}}") endforeach() message(STATUS "print_all_variables------------------------------------------}") endmacro() # add extra lib directories link_directories(/usr/local/lib) # Use the package PkgConfig to detect GTK+ headers/library files FIND_PACKAGE(PkgConfig REQUIRED) PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0) PKG_CHECK_MODULES(AL5 REQUIRED allegro-5) PKG_CHECK_MODULES(AL5AC REQUIRED allegro_acodec-5) PKG_CHECK_MODULES(AL5AU REQUIRED allegro_audio-5) PKG_CHECK_MODULES(AL5MA REQUIRED allegro_main-5) # Setup CMake to use GTK+, tell the compiler where to look for headers # and to the linker where to look for libraries INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS}) MESSAGE(STATUS "Checking on Allegro") MESSAGE(STATUS "Allegro " ${ALL5_LIBRARY_DIRS}) LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS} ${ALL5_LIBRARY_DIRS} ${ALL5AC_LIBARY_DIRS} ${ALL5AU_LIBRARY_DIRS}) # Add other flags to the compiler ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER}) add_executable(gtk simple.c ) add_executable(gtk2 button.c ) add_executable(gtk3 button_audio.c audio.c) # Link the target to the GTK+ libraries TARGET_LINK_LIBRARIES(gtk ${GTK3_LIBRARIES}) TARGET_LINK_LIBRARIES(gtk2 ${GTK3_LIBRARIES}) #TARGET_LINK_LIBRARIES(gtk3 allegro allegro_acodec allegro_main allegro_audio ${GTK3_LIBRARIES}) TARGET_LINK_LIBRARIES(gtk3 allegro allegro_acodec allegro_audio ${GTK3_LIBRARIES}) # specify the dependency on an extra library #target_link_libraries(cpp_audio_thread allegro allegro_main allegro_acodec allegro_audio) print_all_variables()