Skip to content

Commit

Permalink
my argument handling didn't work. implement the only more robust way …
Browse files Browse the repository at this point in the history
…(no matter how gross)
  • Loading branch information
RussTedrake committed Sep 1, 2015
1 parent 1d67f54 commit a2b111d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@ ifeq "$(BUILD_TYPE)" ""
BUILD_TYPE="Release"
endif

override CMAKE_FLAGS:=$(shell echo $(CMAKE_FLAGS))
# The line above is to help passing through multiple CMAKE_FLAGS from the parent.
# Previously, sending in more than one command was not supported because it required
# quotes in the CMakeLists.txt and then the it was acting as only a single argument
# to cmake. This is an age-old problem (see c.f. http://stackoverflow.com/a/9484942 ).
# For the more complicated case, where you want to pass in a string that needs quotes,
# can still handle it in your CMakeLists.txt by using, e.g.
# string(REPLACE \" \\\" CMAKE_FLAGS_FROM_ENV "$ENV{CMAKE_FLAGS}") # turn " into \" for passing through
# and then
# BUILD_COMMAND ${PODS_MAKE_COMMAND} CMAKE_FLAGS="${CMAKE_FLAGS_FROM_ENV} -DWITH_SNOPT=ON -DWITH_BULLET=OFF" BUILD_PREFIX=${CMAKE_INSTALL_PREFIX} BUILD_TYPE=${CMAKE_BUILD_TYPE}
ifneq ($(BUILD_SYSTEM),"Windows_NT")
## extra logic to support complex CMAKE_FLAG inputs (e.g. passed in from CMakeLists.txt) which might have quotes, etc.
CMAKE_FLAGS=$(strip $(shell count=1; eval flag=\$$CMAKE_FLAGS$$count; while [ ! -z "$$flag" ]; do CMAKE_FLAGS="$$CMAKE_FLAGS $$flag"; count=`expr $$count + 1`; eval flag=\$$CMAKE_FLAGS$$count; done; echo $$CMAKE_FLAGS ))
# todo: implement the windows cmd version of this...
endif

.PHONY: all
all: pod-build/Makefile
Expand Down

0 comments on commit a2b111d

Please sign in to comment.