Download Project: Reformat CMake code
+# ~~~
# Distributed under the OSI-approved MIT License. See accompanying
# file LICENSE or https://github.com/Crascit/DownloadProject for details.
#
#
# add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
#
-#========================================================================================
-
+# ~~~
set (_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}")
@@ -101,13 +101,11 @@ function(download_project)
PREFIX
DOWNLOAD_DIR
SOURCE_DIR
- BINARY_DIR
- # Prevent the following from being passed through
+ BINARY_DIR # Prevent the following from being passed through
CONFIGURE_COMMAND
BUILD_COMMAND
INSTALL_COMMAND
- TEST_COMMAND
- )
+ TEST_COMMAND)
set (multiValueArgs "")
cmake_parse_arguments (DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -126,8 +124,7 @@ function(download_project)
if (NOT DL_ARGS_PREFIX)
set (DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
else ()
- get_filename_component(DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE
- BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ get_filename_component (DL_ARGS_PREFIX "${DL_ARGS_PREFIX}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif ()
if (NOT DL_ARGS_DOWNLOAD_DIR)
set (DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
@@ -158,23 +155,18 @@ function(download_project)
# anything to be updated, so extra rebuilds of the project won't occur.
# Make sure to pass through CMAKE_MAKE_PROGRAM in case the main project
# has this set to something not findable on the PATH.
- configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
- "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
- execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
- -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}"
- .
+ configure_file ("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in" "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
+ execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -D "CMAKE_MAKE_PROGRAM:FILE=${CMAKE_MAKE_PROGRAM}" .
RESULT_VARIABLE result
${OUTPUT_QUIET}
- WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
- )
+ WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}")
if (result)
message (FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}")
endif ()
execute_process (COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
${OUTPUT_QUIET}
- WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
- )
+ WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}")
if (result)
message (FATAL_ERROR "Build step for ${DL_ARGS_PROJ} failed: ${result}")
endif ()
