Resolves #342. Allows to add particular project CMAKE args to the main call, together with any other flag.
e.g.
cmake ./SIRF-SuperBuild -DUSE_SYSTEM_BOOST -DNIFTYPET_EXTRA_CMAKE_ARGS:STRING="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" -DSTIR_EXTRA_CMAKE_ARGS:STRING="-DBUILD_SWIG_MATLAB:BOOL=OFF -DDISABLE_ITK:BOOL=ON -DBUILD_MATLAB_WRAPPER:BOOL=ON"
https://github.com/CCPPETMR/SIRF-SuperBuild/pull/348
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
@KrisThielemans requested changes on this pull request.
let's use semi-colons (although confusing) for passing multiple arguments to avoid problems with spaces in filenames etc.
Add example to README.md
Add a line to CHANGES.md
Add yourself to NOTICE.txt
In CMake/SetExternalProjectFlags.cmake:
> @@ -0,0 +1,30 @@ +#======================================================================== +# Author: Ander Biguri +# Copyright 2019 University College London⬇️ Suggested change
-# Copyright 2019 University College London +# Copyright 2020 University College London
In SuperBuild/External_Gadgetron.cmake:
> @@ -35,6 +35,10 @@ set(externalProjName ${proj})
SetCanonicalDirectoryNames(${proj})
+# Get any flag from the superbuild call that may be particular to this projects CMAKE_ARGS
+SetExternalProjectFlags(${proj})
+
+#message(FATAL_ERROR "${proj}_EXTRA_CMAKE_ARGS = \"${${proj}_EXTRA_CMAKE_ARGS}\"")
⬇️ Suggested change
-#message(FATAL_ERROR "${proj}_EXTRA_CMAKE_ARGS = \"${${proj}_EXTRA_CMAKE_ARGS}\"")
In CMake/SetExternalProjectFlags.cmake:
> +# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#=========================================================================
+
+# This defines a macro that gets flags passed to the superbuild to modify particular project cmake flags and marks them as advanced.
+# Allows passing cmake flags to the superbuild to be reused by particular projects.
+
+macro(SetExternalProjectFlags proj)
+
+ set(${proj}_EXTRA_CMAKE_ARGS "" CACHE STRING "Optional extra CMake arguments to be appended to the flags set by the SuperBuild")
+ mark_as_advanced(${proj}_EXTRA_CMAKE_ARGS)
+ string(REPLACE " " ";" ${proj}_EXTRA_CMAKE_ARGS_LIST "${${proj}_EXTRA_CMAKE_ARGS}")
⬇️ Suggested change
- string(REPLACE " " ";" ${proj}_EXTRA_CMAKE_ARGS_LIST "${${proj}_EXTRA_CMAKE_ARGS}")
+ #string(REPLACE " " ";" ${proj}_EXTRA_CMAKE_ARGS_LIST "${${proj}_EXTRA_CMAKE_ARGS}")
In CMake/SetExternalProjectFlags.cmake:
> +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#========================================================================= + +# This defines a macro that gets flags passed to the superbuild to modify particular project cmake flags and marks them as advanced. +# Allows passing cmake flags to the superbuild to be reused by particular projects. + +macro(SetExternalProjectFlags proj) + + set(${proj}_EXTRA_CMAKE_ARGS "" CACHE STRING "Optional extra CMake arguments to be appended to the flags set by the SuperBuild")⬇️ Suggested change
- set(${proj}_EXTRA_CMAKE_ARGS "" CACHE STRING "Optional extra CMake arguments to be appended to the flags set by the SuperBuild")
+ set(${proj}_EXTRA_CMAKE_ARGS "" CACHE STRING "Optional extra CMake arguments to be appended to the flags set by the SuperBuild (use semi-colons for multiple arguments)")
@AnderBiguri pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.
@AnderBiguri pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.
@AnderBiguri pushed 3 commits.
—
You are receiving this because you are subscribed to this thread.
@KrisThielemans done
Closed #348.
@KrisThielemans I can not reopen this myself.
Reopened #348.
Merged #348 into master.