Skip to content

Commit

Permalink
cmake: Improve handling of GPDS dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Tectu committed Aug 23, 2023
1 parent 10b2f99 commit ac06ce8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ option(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD "Whether to pull the GPDS dependency
set(QSCHEMATIC_DEPENDENCY_GPDS_TARGET "gpds::gpds-static" CACHE STRING "The CMake target of the GPDS library to use")
set(CMAKE_DEBUG_POSTFIX d)

# Project requirements
set(QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION "1.6.0")

# Include the library
add_subdirectory(qschematic)

Expand Down
3 changes: 2 additions & 1 deletion qschematic/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD)
FetchContent_Declare(
gpds
GIT_REPOSITORY https://github.com/simulton/gpds
GIT_TAG 1.6.0
GIT_TAG ${QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION}
)
FetchContent_GetProperties(gpds)
if(NOT gpds_POPULATED)
Expand All @@ -24,6 +24,7 @@ if (QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD)
else()
find_package(
gpds
${QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION}
REQUIRED
)
endif()
Expand Down
7 changes: 6 additions & 1 deletion qschematic/qschematic-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include(CMakeFindDependencyMacro)
########################################################################################################################

set(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD @QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD@)
set(QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION @QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION@)

# Qt
find_dependency(
Expand All @@ -27,7 +28,11 @@ endif()

# GPDS
if (NOT QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD)
find_dependency(gpds)
find_dependency(
gpds
${QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION}
REQUIRED
)
endif()

# Add the targets file
Expand Down

0 comments on commit ac06ce8

Please sign in to comment.