Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CMake Variables for easy integration in other CMake Projects. #58

Merged
merged 3 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/Open1722Config.cmake"
INSTALL_DESTINATION "lib/cmake/Open1722"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
INSTALL_DESTINATION "lib/cmake/Open1722")

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/Open1722ConfigVersion.cmake
VERSION "${Open1722_VERSION_MAJOR}.${Open1722_VERSION_MINOR}"
VERSION "${open1722_VERSION_MAJOR}.${open1722_VERSION_MINOR}"
COMPATIBILITY AnyNewerVersion)

install(FILES
Expand All @@ -84,9 +82,8 @@ export(EXPORT Open1722Targets FILE ${CMAKE_CURRENT_BINARY_DIR}/Open1722Targets.c

include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${Open1722_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${Open1722_VERSION_MINOR}")
# set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/release")
set(CPACK_PACKAGE_VERSION_MAJOR "${open1722_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${open1722_VERSION_MINOR}")
set(CPACK_GENERATOR "TGZ" "DEB")
set(CPACK_SOURCE_GENERATOR "TGZ" "DEB")

Expand Down
3 changes: 3 additions & 0 deletions Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/Open1722Targets.cmake")
set(open1722_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
set(open1722_LIBRARIES "@CMAKE_INSTALL_PREFIX@/lib/libopen1722.so"
"@CMAKE_INSTALL_PREFIX@/lib/libopen1722custom.so")
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ add_library(open1722examples STATIC "common/common.c")
target_include_directories(open1722examples PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
$(CMAKE_CURRENT_SOURCE_DIR))
${CMAKE_CURRENT_SOURCE_DIR})

add_dependencies(examples open1722examples)

Expand Down
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,18 @@ target_include_directories(${LIB_NAME} PRIVATE
$<INSTALL_INTERFACE:include>)
set_target_properties(${LIB_NAME} PROPERTIES VERSION ${PROJECT_VERSION})

add_library(${LIB_NAME}custom SHARED)
target_compile_options(${LIB_NAME}custom PRIVATE -Wall -Wextra)
target_include_directories(${LIB_NAME}custom PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(${LIB_NAME}custom PROPERTIES VERSION ${PROJECT_VERSION})

install(TARGETS ${LIB_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS ${LIB_NAME}custom
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

add_subdirectory(avtp)
10 changes: 1 addition & 9 deletions src/avtp/acf/custom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ set(LIB_NAME "${PROJECT_NAME}custom" )

file(GLOB LIB_SOURCES *.c)

add_library(${LIB_NAME} SHARED ${LIB_SOURCES})
target_compile_options(${LIB_NAME} PRIVATE -Wall -Wextra)
target_include_directories(${LIB_NAME} PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(${LIB_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
target_sources(${LIB_NAME} PRIVATE ${LIB_SOURCES})

install(TARGETS ${LIB_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

7 changes: 6 additions & 1 deletion unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
#

include(CTest)
find_package(cmocka 1.1.0 REQUIRED)
find_package(cmocka 1.1.0 QUIET)

if (NOT cmocka_FOUND)
message(STATUS "cmocka not found, tests will not be built")
return()
endif()

target_compile_options(open1722 PRIVATE -coverage)
target_link_options(open1722 PRIVATE -coverage)
Expand Down
Loading