Skip to content

Commit

Permalink
Allow build as stack-build subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
bzeller committed Jul 8, 2024
1 parent eae1db5 commit f7eb8e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ PROJECT( ZYPPER C CXX )
SET( PACKAGE "zypper" )

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
if ( ZYPP_STACK_BUILD )
SET( CMAKE_MODULE_PATH
${zypp-stack_SOURCE_DIR}/libzypp/cmake/modules/
${CMAKE_MODULE_PATH}
)
include_directories(${ZYPP_STACK_INCLUDE_DIRS})
else()
IF (DEFINED ZYPP_PREFIX)
SET( CMAKE_MODULE_PATH
${ZYPP_PREFIX}/${LIB}/cmake/Zypp/
Expand All @@ -14,6 +21,7 @@ ELSE (DEFINED ZYPP_PREFIX)
${CMAKE_MODULE_PATH}
)
ENDIF (DEFINED ZYPP_PREFIX)
endif()

SET( CMAKE_MODULE_PATH
${ZYPPER_SOURCE_DIR}/cmake/modules
Expand Down Expand Up @@ -52,7 +60,15 @@ ENDIF ( LEGACY_ENABLE_LONGOPT_ABBREV )

GENERATE_PACKAGING(${PACKAGE} ${VERSION})

FIND_PACKAGE( Zypp REQUIRED )
if ( ZYPP_STACK_BUILD )
set( ZYPP_FOUND 1 )
set( ZYPP_INCLUDE_DIR ${zypp-stack_SOURCE_DIR}/libzypp )
set( ZYPP_LIBRARY zypp )
set( ZYPP_TUI_LIBRARY zypp-tui )
else()
FIND_PACKAGE( Zypp REQUIRED )
endif()

IF( ZYPP_FOUND )
INCLUDE_DIRECTORIES(${ZYPP_INCLUDE_DIR})
ELSE( ZYPP_FOUND )
Expand Down
4 changes: 2 additions & 2 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ ENDFOREACH()
# creates the .gmo files out of the .po files
SET( SOURCE_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${POT_NAME}.pot )

ADD_CUSTOM_TARGET( translations ALL
ADD_CUSTOM_TARGET( ${PROJECT_NAME}_translations ALL
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/PotfileDiff.sh ${SOURCE_POT_FILE} ${POT_FILE} | grep '^[+-][^+-]' || true
DEPENDS ${GMO_FILES}
COMMENT ".pot file diff..."
)

ADD_CUSTOM_TARGET( potfile_update
ADD_CUSTOM_TARGET( ${PROJECT_NAME}_potfile_update
COMMAND ./PotfileDiff.sh ${SOURCE_POT_FILE} ${POT_FILE} -q || ./PotfileUpadte.sh ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS translations
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ADD_DEFINITIONS( -DTESTS_SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -DTESTS_BUILD_DIR

ADD_SUBDIRECTORY( utils )

ADD_CUSTOM_TARGET( ctest
ADD_CUSTOM_TARGET( ${PROJECT_NAME}_ctest
COMMAND ctest -a
)

Expand Down

0 comments on commit f7eb8e4

Please sign in to comment.