mirror of https://github.com/SeanOMik/swm.git
Link (hopefully) libxcb and toml11
This commit is contained in:
parent
3abd3641d5
commit
60e88ca702
|
@ -0,0 +1,2 @@
|
|||
.cache
|
||||
build
|
|
@ -0,0 +1,51 @@
|
|||
# - FindXCB
|
||||
#
|
||||
# Copyright (C) 2015 Valve Corporation
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(NOT XCB_FIND_COMPONENTS)
|
||||
set(XCB_FIND_COMPONENTS XCB)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
set(XCB_FOUND true)
|
||||
set(XCB_INCLUDE_DIRS "")
|
||||
set(XCB_LIBRARIES "")
|
||||
foreach(comp ${XCB_FIND_COMPONENTS})
|
||||
# component name
|
||||
string(TOUPPER ${comp} compname)
|
||||
string(REPLACE "-" "_" compname ${compname})
|
||||
# header name
|
||||
string(REPLACE "xcb-" "" headername xcb/${comp}.h)
|
||||
# library name
|
||||
set(libname ${comp})
|
||||
|
||||
pkg_check_modules(PC_${comp} QUIET ${comp})
|
||||
|
||||
find_path(${compname}_INCLUDE_DIR NAMES ${headername}
|
||||
HINTS
|
||||
${PC_${comp}_INCLUDEDIR}
|
||||
${PC_${comp}_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(${compname}_LIBRARY NAMES ${libname}
|
||||
HINTS
|
||||
${PC_${comp}_LIBDIR}
|
||||
${PC_${comp}_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(${comp}
|
||||
FOUND_VAR ${comp}_FOUND
|
||||
REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY)
|
||||
mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY)
|
||||
|
||||
list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR})
|
||||
list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY})
|
||||
|
||||
if(NOT ${comp}_FOUND)
|
||||
set(XCB_FOUND false)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS)
|
|
@ -0,0 +1,21 @@
|
|||
cmake_minimum_required (VERSION 3.6)
|
||||
project(swm_project DESCRIPTION "swm (swim) is a simple dynamic window manager.")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
|
||||
|
||||
add_executable(swm src/main.cpp)
|
||||
|
||||
find_package(XCB REQUIRED)
|
||||
find_package(toml11 REQUIRED)
|
||||
|
||||
# Link headers and source files.
|
||||
file(GLOB_RECURSE source_list src/*.cpp)
|
||||
target_sources(swm PRIVATE ${source_list})
|
||||
target_include_directories(swm PUBLIC include)
|
||||
|
||||
# Link depends
|
||||
target_link_libraries(swm PUBLIC ${XCB_LIBRARIES})
|
||||
target_link_libraries(swm PUBLIC toml11::toml11)
|
||||
|
||||
# Set standard to C++20
|
||||
set_target_properties(swm PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF)
|
|
@ -0,0 +1,6 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "hello world" << std::endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue