smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

enhance xpGetArgValue cont'd #254

Closed smanders closed 5 years ago

smanders commented 5 years ago

a previous issue (enhance xpGetArgValue https://github.com/smanders/externpro/issues/93) made it possible to retrieve "multi value" arguments -- see commit https://github.com/smanders/externpro/commit/0b10df72a0cac738a79325a5e7629c87402d49ed

however, there are issues with the multi value argument support added

for example, I was trying to get the BUILD_DEPS from PRO_ACTIVEMQCPP

set(PRO_ACTIVEMQCPP
  NAME activemqcpp
  WEB "ActiveMQ-CPP" http://activemq.apache.org/cms/ "ActiveMQ CMS website"
  LICENSE "open" http://www.apache.org/licenses/LICENSE-2.0.html "Apache 2.0"
  DESC "ActiveMQ C++ Messaging Service (CMS) client library"
  REPO "repo" ${REPO} "forked ${PROJ} repo on github"
  GRAPH BUILD_DEPS apr openssl_1.0.2a
  VER ${VER}
  GIT_ORIGIN git://github.com/smanders/${PROJ}.git
  GIT_UPSTREAM git://github.com/apache/${PROJ}.git
  GIT_TAG xp-${VER} # what to 'git checkout'
  GIT_REF ${PROJ}-${VER} # create patch from this tag to 'git checkout'
  DLURL https://archive.apache.org/dist/activemq/${PROJ}/${VER}/${PROJ}-library-${VER}-src.tar.gz
  DLMD5 414ac7de16d305058c7f0e2a333a5960
  PATCH ${PATCH_DIR}/activemqcpp.patch
  # TRICKY: PATCH_STRIP because the repo has an extra level of directories that the .tar.gz file doesn't have
  PATCH_STRIP 2 # Strip NUM leading components from file names (defaults to 1)
  DIFF ${REPO}/compare/apache:
  )

with the call

xpGetArgValue(${PRO_ACTIVEMQCPP} ARG BUILD_DEPS VALUES BUILD_DEPS)

and the BUILD_DEPS returned would include everything in PRO_ACTIVEMQCPP after BUILD_DEPS

there's currently no way for xpGetArgValue() to know what the next argument is to know what is part of the multi-value argument and what is the next thing

smanders commented 5 years ago

solution: if xpGetArgValue() had another single value argument NEXT so that the next label/argument can be differentiated then this would improve multi-value arguments to give the correct result

this isn't pretty... not very good that the order of what's in the PRO_* has to be known and if the order changes the calls to xpGetArgValue() may need to be updated... (that's more fragile than I wish it was)

xpGetArgValue(${PRO_ACTIVEMQCPP} ARG BUILD_DEPS VALUES BUILD_DEPS NEXT VER)

NEXT tells xpGetArgValue() that VER is right after BUILD_DEPS, so it will know that apr openssl_1.0.2a are the multi-value args for BUILD_DEPS and VER is the start of the next field

smanders commented 5 years ago

completed with commit to dev branch referenced above