mirror of
https://github.com/tdulcet/Table-and-Graph-Libs.git
synced 2025-05-05 21:41:12 +08:00
Cmake integration (#4)
This commit is contained in:
parent
dd674e68e5
commit
60728a7c44
30
CMakeLists.txt
Normal file
30
CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.21)
|
||||||
|
project(tglib LANGUAGES CXX)
|
||||||
|
|
||||||
|
# leave compiler options up to parent project, as these libs are header-only
|
||||||
|
|
||||||
|
# create header-only interface target for graphs.hpp
|
||||||
|
add_library(tglib_graphs INTERFACE)
|
||||||
|
add_library(${PROJECT_NAME}::graphs ALIAS tglib_graphs)
|
||||||
|
target_sources(tglib_graphs PUBLIC
|
||||||
|
FILE_SET HEADERS
|
||||||
|
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
FILES graphs.hpp)
|
||||||
|
|
||||||
|
# create header-only interface target for tables.hpp
|
||||||
|
add_library(tglib_tables INTERFACE)
|
||||||
|
add_library(${PROJECT_NAME}::tables ALIAS tglib_tables)
|
||||||
|
target_sources(tglib_tables PUBLIC
|
||||||
|
FILE_SET HEADERS
|
||||||
|
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
FILES tables.hpp)
|
||||||
|
|
||||||
|
# compile example binaries as executables
|
||||||
|
if (PROJECT_IS_TOP_LEVEL)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
add_executable(tglib_graphs_example "${CMAKE_CURRENT_SOURCE_DIR}/graphs.cpp")
|
||||||
|
target_link_libraries(tglib_graphs_example PRIVATE tglib::graphs)
|
||||||
|
add_executable(tglib_tables_example "${CMAKE_CURRENT_SOURCE_DIR}/tables.cpp")
|
||||||
|
target_link_libraries(tglib_tables_example PRIVATE tglib::tables)
|
||||||
|
endif()
|
@ -1,5 +1,5 @@
|
|||||||
// Teal Dulcet, CS546
|
// Teal Dulcet, CS546
|
||||||
|
#pragma once
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -19,8 +19,13 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef TGLIB_GRAPHS_NAMESPACE
|
||||||
|
namespace TGLIB_GRAPHS_NAMESPACE
|
||||||
|
{
|
||||||
|
#else
|
||||||
namespace graphs
|
namespace graphs
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
enum style_type
|
enum style_type
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Teal Dulcet, CS546
|
// Teal Dulcet, CS546
|
||||||
|
#pragma once
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -14,8 +14,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
#ifdef TGLIB_TABLES_NAMESPACE
|
||||||
|
namespace TGLIB_TABLES_NAMESPACE
|
||||||
|
{
|
||||||
|
#else
|
||||||
namespace tables
|
namespace tables
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
enum style_type
|
enum style_type
|
||||||
|
Loading…
Reference in New Issue
Block a user