Skip to content

Commit

Permalink
chore: new CMate YAML files
Browse files Browse the repository at this point in the history
  • Loading branch information
chybz committed Jul 14, 2024
1 parent 939a6eb commit e77ac75
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
39 changes: 22 additions & 17 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,37 @@ project(cucumber_messages VERSION 0.1.0 LANGUAGES C CXX)

include(GNUInstallDirs)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(WIN32)
add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
endif()

find_package(nlohmann_json CONFIG REQUIRED)
set(${CUCUMBER_MESSAGES_LOCAL_DEV} OFF)

if(${CUCUMBER_MESSAGES_LOCAL_DEV})
set(CUCUMBER_MESSAGES_BUILD_TESTS_INIT ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
else()
set(CUCUMBER_MESSAGES_BUILD_TESTS_INIT OFF)
endif()

option(CUCUMBER_MESSAGES_BUILD_TESTS "Build the unit tests." ${CUCUMBER_MESSAGES_BUILD_TESTS_INIT})


find_package(nlohmann_json CONFIG REQUIRED)
add_subdirectory(src/lib/messages)
if(CUCUMBER_MESSAGES_BUILD_TESTS)
include(CTest)
enable_testing()
endif()


install(
TARGETS
cucumber_messages_lib
EXPORT cucumber_messages-config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION \${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION \${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION \${CMAKE_INSTALL_LIBDIR}
)

install(
Expand All @@ -33,8 +43,3 @@ install(
NAMESPACE cucumber::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cucumber_messages
)

install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/messages/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cucumber
)
10 changes: 0 additions & 10 deletions cpp/project.json

This file was deleted.

8 changes: 8 additions & 0 deletions cpp/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: cucumber_messages
version: 0.1.0
namespace: cucumber
std: 17
packages:
cmake:
- nlohmann_json:
8 changes: 4 additions & 4 deletions cpp/src/lib/messages/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ add_library(cucumber_messages_lib)
add_library(cucumber::messages ALIAS cucumber_messages_lib)

set(CUCUMBER_MESSAGES_LIB_INC_DIR "${PROJECT_SOURCE_DIR}/include/messages")
file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_HEADERS ${CUCUMBER_MESSAGES_LIB_INC_DIR}/*.hpp)
file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_HEADERS "${CUCUMBER_MESSAGES_LIB_INC_DIR}/*.hpp")
list(APPEND CUCUMBER_MESSAGES_LIB_ALL_SOURCES ${CUCUMBER_MESSAGES_LIB_HEADERS})

set(CUCUMBER_MESSAGES_LIB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_SOURCES ${CUCUMBER_MESSAGES_LIB_SRC_DIR}/*.[ch]pp)
file(GLOB_RECURSE CUCUMBER_MESSAGES_LIB_SOURCES "${CUCUMBER_MESSAGES_LIB_SRC_DIR}/*.[ch]pp")
list(APPEND CUCUMBER_MESSAGES_LIB_ALL_SOURCES ${CUCUMBER_MESSAGES_LIB_SOURCES})

target_sources(
Expand All @@ -19,7 +19,7 @@ target_include_directories(
cucumber_messages_lib
PUBLIC
$<BUILD_INTERFACE:${CUCUMBER_MESSAGES_LIB_INC_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cucumber>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand All @@ -29,10 +29,10 @@ target_link_libraries(
PUBLIC
nlohmann_json::nlohmann_json
)

set_target_properties(
cucumber_messages_lib
PROPERTIES
CXX_STANDARD 17
VERSION 0.1.0
SOVERSION 0.1
EXPORT_NAME messages
Expand Down
7 changes: 0 additions & 7 deletions cpp/src/lib/messages/link.json

This file was deleted.

4 changes: 4 additions & 0 deletions cpp/src/lib/messages/link.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
libs:
public:
- nlohmann_json::nlohmann_json

0 comments on commit e77ac75

Please sign in to comment.