stamen

Static Menu Generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |

commit8af1469e5448a18f63b83bf7b144d18d87940f5b
parent4353db0fc0af665ffe8a735c52da61b641ab92c9
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateFri, 17 Nov 2023 17:47:25 +0000

Ability to install library and executable

Diffstat:
MCMakeLists.txt|+-
Mdemo/CMakeLists.txt|++++-----
Msrc/CMakeLists.txt|++++++++++++++++++---------------------
Msrc/generate.cpp|+-

4 files changed, 24 insertions(+), 28 deletions(-)


diff --git a/CMakeLists.txt b/CMakeLists.txt

@@ -3,7 +3,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(
Stamen
VERSION 0.0.9
VERSION 0.0.10
DESCRIPTION "Static menu generator"
LANGUAGES CXX
)

diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt

@@ -5,22 +5,21 @@ add_executable(demo

target_link_libraries(demo
stamen
stamen-display
)
ADD_CUSTOM_COMMAND(
add_custom_command(
OUTPUT demo_menu.h demo_menu.cpp
COMMAND ${CMAKE_BINARY_DIR}/bin/stamen-generate ${CMAKE_CURRENT_SOURCE_DIR}/demo_menu.conf
DEPENDS demo_menu.conf stamen-generate
COMMENT "Generating menu files"
)
ADD_CUSTOM_TARGET(GenerateMenu
add_custom_target(GenerateMenu
DEPENDS demo_menu.h demo_menu.cpp
COMMENT "Check if re-generation of menu files is required"
)
ADD_DEPENDENCIES(demo GenerateMenu)
add_dependencies(demo GenerateMenu)
set_target_properties(demo PROPERTIES
VERSION ${PROJECT_VERSION}

@@ -28,4 +27,4 @@ set_target_properties(demo PROPERTIES

RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
CONFIGURE_FILE(demo_menu.conf ${CMAKE_BINARY_DIR}/bin/demo_menu.conf COPYONLY)
configure_file(demo_menu.conf ${CMAKE_BINARY_DIR}/bin/demo_menu.conf COPYONLY)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt

@@ -1,29 +1,26 @@

add_library(stamen INTERFACE)
target_include_directories(stamen
INTERFACE ../include
)
add_library(stamen-display
stamen.cpp
)
target_link_libraries(stamen-display
PRIVATE stamen
)
add_library(stamen-include INTERFACE)
target_include_directories(stamen-include INTERFACE ../include)
add_executable(stamen-generate generate.cpp)
target_link_libraries(stamen-generate
PRIVATE stamen
)
target_include_directories(stamen-generate
PUBLIC ../include
)
target_link_libraries(stamen-generate PRIVATE stamen-include)
target_include_directories(stamen-generate PUBLIC ../include)
set_target_properties(stamen-generate PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
add_library(stamen stamen.cpp)
target_link_libraries(stamen PUBLIC stamen-include)
set_target_properties(stamen PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER ../include/stamen.h
)
install(TARGETS stamen-generate DESTINATION bin)
install(TARGETS stamen
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
)

diff --git a/src/generate.cpp b/src/generate.cpp

@@ -5,7 +5,7 @@ using namespace stamen;

int main(const int argc, const char *argv[]) {
if (argc != 2) {
std::cout << "please enter at exaclty one config file" << std::endl;
std::cout << "please enter exaclty one config file" << std::endl;
return 1;
}