Skip to content

Commit

Permalink
Add mechanism to not apply Qwt patch multiple times.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Dec 7, 2024
1 parent ef734f7 commit 545eb5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt.qwt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ExternalProject_Add(qwt
GIT_REPOSITORY https://git.code.sf.net/p/qwt/git
GIT_TAG 9e554a5e03bc3a1fe379bdddfa4d21ced2ed7995
CONFIGURE_COMMAND qmake "${CMAKE_CURRENT_BINARY_DIR}/qwt/qwt/src/qwt/qwt.pro"
PATCH_COMMAND git apply --quiet "${CMAKE_CURRENT_SOURCE_DIR}/qwt.patch"
PATCH_COMMAND git apply --allow-empty "@QWT_PATCH_FILE@"
BUILD_COMMAND "@QWT_BUILD_COMMAND@"
INSTALL_COMMAND ""
)
10 changes: 10 additions & 0 deletions qwt_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ function(QWT_SETUP)
set(QWT_BUILD_COMMAND ${CMAKE_MAKE_PROGRAM})
endif()

set(PATCH_MARKER "${CMAKE_CURRENT_BINARY_DIR}/qwt_patch_applied.txt")
if (NOT EXISTS "${PATCH_MARKER}")
set(QWT_PATCH_FILE ${CMAKE_CURRENT_SOURCE_DIR}/qwt.patch)
message(STATUS "Using QWT_PATCH_FILE=${QWT_PATCH_FILE}")
file(TOUCH ${PATCH_MARKER})
else()
set(QWT_PATCH_FILE ${PATCH_MARKER})
message(STATUS "Qwt patch already applied. Using empty file as QWT_PATCH_FILE=${PATCH_MARKER}")
endif()

configure_file(CMakeLists.txt.qwt qwt/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/qwt)
execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/qwt)
Expand Down

0 comments on commit 545eb5a

Please sign in to comment.