Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LidarView
LidarView-Superbuild
Commits
465c3732
Commit
465c3732
authored
Dec 19, 2017
by
Nicolas Vuaille
Committed by
Nick Laurenson
Dec 05, 2018
Browse files
Use paraview common-superbuild
bump boost to 1.59 (default from Common Superbuild) use liblas config from paraview-superbuild
parent
1b517456
Changes
38
Expand all
Hide whitespace changes
Inline
Side-by-side
CMake/PVExternalProject.cmake
deleted
100644 → 0
View file @
1b517456
# Extends ExternalProject_Add(...) by adding a new option.
# PROCESS_ENVIRONMENT <environment variables>
# When present the BUILD_COMMAND and CONFIGURE_COMMAND are executed as a
# sub-process (using execute_process()) so that the sepecified environment
# is passed on to the executed command (which does not happen by default).
# This will be deprecated once CMake starts supporting it.
include
(
ExternalProject
)
string
(
REPLACE
")"
"|PROCESS_ENVIRONMENT)"
_ep_keywords_PVExternalProject_Add
"
${
_ep_keywords_ExternalProject_Add
}
"
)
#------------------------------------------------------------------------------
# win32 version of the macro that simply strips the PROCESS_ENVIRONMENT and call
# ExternalProject_Add().
function
(
_PVExternalProject_Add_Win32 name
)
set
(
arguments
)
set
(
optional_depends
)
set
(
accumulate TRUE
)
foreach
(
arg IN LISTS ARGN
)
if
(
"
${
arg
}
"
MATCHES
"^PROCESS_ENVIRONMENT$"
)
set
(
accumulate FALSE
)
elseif
(
"
${
arg
}
"
MATCHES
"
${
_ep_keywords_ExternalProject_Add
}
"
)
set
(
accumulate TRUE
)
endif
()
if
(
accumulate
)
list
(
APPEND arguments
"
${
arg
}
"
)
endif
()
endforeach
()
ExternalProject_Add
(
${
name
}
"
${
arguments
}
"
)
unset
(
arguments
)
unset
(
optional_depends
)
unset
(
accumulate
)
endfunction
()
function
(
PVExternalProject_Add name
)
if
(
WIN32
)
_PVExternalProject_Add_Win32
(
${
name
}
"
${
ARGN
}
"
)
return
()
endif
()
# process arguments are detect USE_ENVIRONMENT, BUILD_COMMAND and
# CONFIGURE_COMMAND.
# just create a temporary target so we can set target properties.
add_custom_target
(
pv-
${
name
}
)
set
(
binary_dir
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
name
}
/src/
${
name
}
-build
)
_ep_parse_arguments
(
PVExternalProject_Add pv-
${
name
}
_EP_
"
${
ARGN
}
"
)
get_property
(
has_process_environment TARGET pv-
${
name
}
PROPERTY _EP_PROCESS_ENVIRONMENT SET
)
if
(
NOT has_process_environment
)
ExternalProject_Add
(
${
name
}
"
${
ARGN
}
"
)
return
()
endif
()
set
(
new_argn
)
#check for configure command
get_property
(
has_configure_command TARGET pv-
${
name
}
PROPERTY _EP_CONFIGURE_COMMAND SET
)
#override the configure command
if
(
has_configure_command
)
get_property
(
configure_cmd TARGET pv-
${
name
}
PROPERTY _EP_CONFIGURE_COMMAND
)
if
(
configure_cmd STREQUAL
""
)
list
(
APPEND new_argn CONFIGURE_COMMAND
"
${
configure_cmd
}
"
)
set
(
has_configure_command 0
)
#we don't want to call execute process
else
()
list
(
APPEND new_argn
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/pv-
${
name
}
-configure.cmake
)
endif
()
endif
()
# check if we have a BUILD_COMMAND
get_property
(
has_build_command TARGET pv-
${
name
}
PROPERTY _EP_BUILD_COMMAND SET
)
if
(
has_build_command
)
get_property
(
build_cmd TARGET pv-
${
name
}
PROPERTY _EP_BUILD_COMMAND
)
#if the build command is an empty string it means we don't have a build
#command and we need to explicitly not create the external process
#build step, but instead pass down an empty build step
if
(
build_cmd STREQUAL
""
)
list
(
APPEND new_argn BUILD_COMMAND
"
${
build_cmd
}
"
)
set
(
has_build_command 0
)
#we don't want to call execute process
endif
()
else
()
# if no BUILD_COMMAND was specified, then the default build cmd is going to
# be used, but then too we want to environment to be setup correctly. So we
# obtain the default build command.
_ep_get_build_command
(
pv-
${
name
}
BUILD build_cmd
)
if
(
"
${
build_cmd
}
"
MATCHES
"^
\\
$
\\
(MAKE
\\
)"
)
# GNU make recognizes the string "$(MAKE)" as recursive make, so
# ensure that it appears directly in the makefile.
string
(
REGEX REPLACE
"^
\\
$
\\
(MAKE
\\
)"
"
${
CMAKE_MAKE_PROGRAM
}
-j5"
build_cmd
"
${
build_cmd
}
"
)
endif
()
set_property
(
TARGET pv-
${
name
}
PROPERTY _EP_BUILD_COMMAND
"
${
build_cmd
}
"
)
set
(
has_build_command 1
)
endif
()
#setup the new build command
if
(
has_build_command
)
list
(
APPEND new_argn
BUILD_COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/pv-
${
name
}
-build.cmake
)
endif
()
#check for install command, we always enforce an install command
get_property
(
has_install_command TARGET pv-
${
name
}
PROPERTY _EP_INSTALL_COMMAND SET
)
if
(
has_install_command
)
get_property
(
install_cmd TARGET pv-
${
name
}
PROPERTY _EP_INSTALL_COMMAND
)
else
()
_ep_get_build_command
(
pv-
${
name
}
INSTALL install_cmd
)
endif
()
#write out the new install command
list
(
APPEND new_argn INSTALL_COMMAND
"
${
install_cmd
}
"
)
# now strip PROCESS_ENVIRONMENT from argments.
set
(
skip TRUE
)
foreach
(
arg IN LISTS ARGN
)
if
(
arg MATCHES
"
${
_ep_keywords_PVExternalProject_Add
}
"
)
if
(
arg MATCHES
"^(PROCESS_ENVIRONMENT|BUILD_COMMAND|INSTALL_COMMAND|CONFIGURE_COMMAND)$"
)
set
(
skip FALSE
)
else
()
set
(
skip TRUE
)
endif
()
endif
()
if
(
skip
)
list
(
APPEND new_argn
${
arg
}
)
endif
()
endforeach
()
#new_argn has to be quoted to keep empty list elements around
#so that we properly parse empty install, configure, build, etc
ExternalProject_Add
(
${
name
}
"
${
new_argn
}
"
)
# configure the scripts after the call ExternalProject_Add() since that sets
# up the directories correctly.
get_target_property
(
process_environment pv-
${
name
}
_EP_PROCESS_ENVIRONMENT
)
_ep_replace_location_tags
(
${
name
}
process_environment
)
if
(
has_configure_command
)
get_target_property
(
step_command pv-
${
name
}
_EP_CONFIGURE_COMMAND
)
_ep_replace_location_tags
(
${
name
}
step_command
)
configure_file
(
${
SuperBuild_CMAKE_DIR
}
/pep_configure.cmake.in
${
CMAKE_CURRENT_BINARY_DIR
}
/pv-
${
name
}
-configure.cmake
@ONLY
)
endif
()
if
(
has_build_command
)
get_target_property
(
step_command pv-
${
name
}
_EP_BUILD_COMMAND
)
_ep_replace_location_tags
(
${
name
}
step_command
)
configure_file
(
${
SuperBuild_CMAKE_DIR
}
/pep_configure.cmake.in
${
CMAKE_CURRENT_BINARY_DIR
}
/pv-
${
name
}
-build.cmake
@ONLY
)
endif
()
endfunction
()
CMake/ParaViewModules.cmake
deleted
100644 → 0
View file @
1b517456
include
(
PVExternalProject
)
include
(
CMakeParseArguments
)
#------------------------------------------------------------------------------
# Macro to be used to register versions for any module. This makes it easier to
# consolidate versions for all modules in a single file, if needed.
macro
(
add_revision name
)
set
(
${
name
}
_revision
"
${
ARGN
}
"
)
endmacro
()
#------------------------------------------------------------------------------
macro
(
add_external_project _name
)
project_check_name
(
${
_name
}
)
set
(
cm-project
${
_name
}
)
set
(
${
cm-project
}
_DECLARED 1
)
if
(
build-projects
)
set
(
arguments
)
set
(
optional_depends
)
set
(
accumulate FALSE
)
set
(
project_arguments
"
${
ARGN
}
"
)
#need quotes to keep empty list items
foreach
(
arg IN LISTS project_arguments
)
if
(
"
${
arg
}
"
MATCHES
"^DEPENDS_OPTIONAL$"
)
set
(
accumulate TRUE
)
elseif
(
"
${
arg
}
"
MATCHES
"
${
_ep_keywords_ExternalProject_Add
}
"
)
set
(
accumulate FALSE
)
elseif
(
accumulate
)
list
(
APPEND optional_depends
"
${
arg
}
"
)
endif
()
if
(
NOT accumulate
)
list
(
APPEND arguments
"
${
arg
}
"
)
endif
()
endforeach
()
foreach
(
op_dep
${
optional_depends
}
)
if
(
${
op_dep
}
_ENABLED
)
list
(
APPEND arguments DEPENDS
${
op_dep
}
)
#message(STATUS "OPTIONAL DEPENDENCY ${cm-project}->${op_dep}")
endif
()
endforeach
()
set
(
${
cm-project
}
_ARGUMENTS
"
${
arguments
}
"
)
unset
(
arguments
)
unset
(
optional_depends
)
unset
(
accumulate
)
else
()
set
(
${
cm-project
}
_DEPENDS
""
)
set
(
${
cm-project
}
_ARGUMENTS
""
)
set
(
${
cm-project
}
_NEEDED_BY
""
)
set
(
${
cm-project
}
_DEPENDS_ANY
""
)
set
(
${
cm-project
}
_DEPENDS_OPTIONAL
""
)
set
(
${
cm-project
}
_CAN_USE_SYSTEM 0
)
set
(
doing
""
)
set
(
project_arguments
"
${
ARGN
}
"
)
#need quotes to keep empty list items
foreach
(
arg IN LISTS project_arguments
)
if
(
"
${
arg
}
"
MATCHES
"^DEPENDS$"
)
set
(
doing
"DEPENDS"
)
elseif
(
"
${
arg
}
"
MATCHES
"^DEPENDS_OPTIONAL$"
)
set
(
doing
"DEPENDS_OPTIONAL"
)
elseif
(
"
${
arg
}
"
MATCHES
"
${
_ep_keywords_ExternalProject_Add
}
"
)
set
(
doing
""
)
elseif
(
doing STREQUAL
"DEPENDS"
)
list
(
APPEND
${
cm-project
}
_DEPENDS
"
${
arg
}
"
)
elseif
(
doing STREQUAL
"DEPENDS_OPTIONAL"
)
list
(
APPEND
${
cm-project
}
_DEPENDS_OPTIONAL
"
${
arg
}
"
)
endif
()
endforeach
()
option
(
ENABLE_
${
cm-project
}
"Request to build project
${
cm-project
}
"
OFF
)
set_property
(
CACHE ENABLE_
${
cm-project
}
PROPERTY TYPE BOOL
)
list
(
APPEND CM_PROJECTS_ALL
"
${
cm-project
}
"
)
if
(
USE_SYSTEM_
${
cm-project
}
)
set
(
${
cm-project
}
_DEPENDS
""
)
set
(
${
cm-project
}
_DEPENDS_OPTIONAL
""
)
endif
()
set
(
${
cm-project
}
_DEPENDS_ANY
${${
cm-project
}
_DEPENDS
}
${${
cm-project
}
_DEPENDS_OPTIONAL
}
)
endif
()
endmacro
()
#------------------------------------------------------------------------------
# adds a dummy project to the build, which is a great way to setup a list
# of dependencies as a build option. IE dummy project that turns on all
# third party libraries
macro
(
add_external_dummy_project _name
)
if
(
build-projects
)
add_external_project
(
${
_name
}
"
${
ARGN
}
"
)
else
()
add_external_project
(
${
_name
}
"
${
ARGN
}
"
)
set
(
${
_name
}
_IS_DUMMY_PROJECT TRUE CACHE INTERNAL
"Project just used to represent a logical block of dependencies"
)
endif
()
endmacro
()
#------------------------------------------------------------------------------
# similar to add_external_project, except provides the user with an option to
# use-system installation of the project.
macro
(
add_external_project_or_use_system _name
)
if
(
build-projects
)
add_external_project
(
${
_name
}
"
${
ARGN
}
"
)
else
()
add_external_project
(
${
_name
}
"
${
ARGN
}
"
)
set
(
${
_name
}
_CAN_USE_SYSTEM 1
)
# add an option an hide it by default. We'll expose it to the user if needed.
option
(
USE_SYSTEM_
${
_name
}
"Use system
${
_name
}
"
OFF
)
set_property
(
CACHE USE_SYSTEM_
${
_name
}
PROPERTY TYPE INTERNAL
)
endif
()
endmacro
()
#------------------------------------------------------------------------------
macro
(
process_dependencies
)
set
(
CM_PROJECTS_ENABLED
""
)
foreach
(
cm-project IN LISTS CM_PROJECTS_ALL
)
set
(
${
cm-project
}
_ENABLED FALSE
)
if
(
ENABLE_
${
cm-project
}
)
list
(
APPEND CM_PROJECTS_ENABLED
${
cm-project
}
)
endif
()
endforeach
()
list
(
SORT CM_PROJECTS_ENABLED
)
# Deterministic order.
# Order list to satisfy dependencies.
# First only use the non-optional dependencies.
include
(
TopologicalSort
)
topological_sort
(
CM_PROJECTS_ENABLED
""
_DEPENDS
)
# Now generate a project order using both, optional and non-optional
# dependencies.
set
(
CM_PROJECTS_ORDER
${
CM_PROJECTS_ENABLED
}
)
topological_sort
(
CM_PROJECTS_ORDER
""
_DEPENDS_ANY
)
# Update CM_PROJECTS_ENABLED to be in the correct order taking into
# consideration optional dependencies.
set
(
new_order
)
foreach
(
cm-project IN LISTS CM_PROJECTS_ORDER
)
list
(
FIND CM_PROJECTS_ENABLED
"
${
cm-project
}
"
found
)
if
(
found GREATER -1
)
list
(
APPEND new_order
"
${
cm-project
}
"
)
endif
()
endforeach
()
set
(
CM_PROJECTS_ENABLED
${
new_order
}
)
# build information about what project needs what.
foreach
(
cm-project IN LISTS CM_PROJECTS_ENABLED
)
enable_project
(
${
cm-project
}
""
)
foreach
(
dependency IN LISTS
${
cm-project
}
_DEPENDS
)
enable_project
(
${
dependency
}
"
${
cm-project
}
"
)
endforeach
()
endforeach
()
foreach
(
cm-project IN LISTS CM_PROJECTS_ENABLED
)
if
(
ENABLE_
${
cm-project
}
)
message
(
STATUS
"Enabling
${
cm-project
}
as requested."
)
set_property
(
CACHE ENABLE_
${
cm-project
}
PROPERTY TYPE BOOL
)
else
()
list
(
SORT
${
cm-project
}
_NEEDED_BY
)
list
(
REMOVE_DUPLICATES
${
cm-project
}
_NEEDED_BY
)
message
(
STATUS
"Enabling
${
cm-project
}
since needed by:
${${
cm-project
}
_NEEDED_BY
}
"
)
set_property
(
CACHE ENABLE_
${
cm-project
}
PROPERTY TYPE INTERNAL
)
endif
()
endforeach
()
message
(
STATUS
"PROJECTS_ENABLED
${
CM_PROJECTS_ENABLED
}
"
)
set
(
build-projects 1
)
foreach
(
cm-project IN LISTS CM_PROJECTS_ENABLED
)
if
(
${
cm-project
}
_CAN_USE_SYSTEM
)
# for every enabled project that can use system, expose the option to the
# user.
set_property
(
CACHE USE_SYSTEM_
${
cm-project
}
PROPERTY TYPE BOOL
)
if
(
USE_SYSTEM_
${
cm-project
}
)
add_external_dummy_project_internal
(
${
cm-project
}
)
include
(
${
cm-project
}
.use.system OPTIONAL RESULT_VARIABLE rv
)
if
(
rv STREQUAL
"NOTFOUND"
)
message
(
AUTHOR_WARNING
"
${
cm-project
}
.use.system not found!!!"
)
endif
()
else
()
include
(
${
cm-project
}
)
add_external_project_internal
(
${
cm-project
}
"
${${
cm-project
}
_ARGUMENTS
}
"
)
endif
()
elseif
(
${
cm-project
}
_IS_DUMMY_PROJECT
)
#this project isn't built, just used as a graph node to
#represent a group of dependencies
add_external_dummy_project_internal
(
${
cm-project
}
)
else
()
include
(
${
cm-project
}
)
add_external_project_internal
(
${
cm-project
}
"
${${
cm-project
}
_ARGUMENTS
}
"
)
endif
()
endforeach
()
unset
(
build-projects
)
endmacro
()
#------------------------------------------------------------------------------
macro
(
enable_project name needed-by
)
set
(
${
name
}
_ENABLED TRUE CACHE INTERNAL
""
FORCE
)
list
(
APPEND
${
name
}
_NEEDED_BY
"
${
needed-by
}
"
)
endmacro
()
#------------------------------------------------------------------------------
# internal macro to validate project names.
macro
(
project_check_name _name
)
if
(
NOT
"
${
_name
}
"
MATCHES
"^[a-zA-Z][a-zA-Z0-9]*$"
)
message
(
FATAL_ERROR
"Invalid project name:
${
_name
}
"
)
endif
()
endmacro
()
#------------------------------------------------------------------------------
# get dependencies for a project, including optional dependencies that are
# currently enabled. Since this macro looks at the ${mod}_ENABLED flag, it
# cannot be used in the 'processing' pass, but the 'build' pass alone.
macro
(
get_project_depends _name _prefix
)
if
(
NOT build-projects
)
message
(
AUTHOR_WARNING
"get_project_depends can only be used in build pass"
)
endif
()
if
(
NOT
${
_prefix
}
_
${
_name
}
_done
)
set
(
${
_prefix
}
_
${
_name
}
_done 1
)
# process regular dependencies
foreach
(
dep
${${
_name
}
_DEPENDS
}
)
if
(
NOT
${
_prefix
}
_
${
dep
}
_done
)
list
(
APPEND
${
_prefix
}
_DEPENDS
${
dep
}
)
get_project_depends
(
${
dep
}
${
_prefix
}
)
endif
()
endforeach
()
# process optional dependencies (only consider those that are enabled).
foreach
(
dep
${${
_name
}
_DEPENDS_OPTIONAL
}
)
if
(
${
dep
}
_ENABLED AND NOT
${
_prefix
}
_
${
dep
}
_done
)
list
(
APPEND
${
_prefix
}
_DEPENDS
${
dep
}
)
get_project_depends
(
${
dep
}
${
_prefix
}
)
endif
()
endforeach
()
endif
()
endmacro
()
#------------------------------------------------------------------------------
function
(
add_external_dummy_project_internal name
)
ExternalProject_Add
(
${
name
}
DOWNLOAD_COMMAND
""
SOURCE_DIR
""
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
)
endfunction
()
#------------------------------------------------------------------------------
function
(
add_external_project_internal name
)
set
(
cmake_params
)
foreach
(
flag CMAKE_BUILD_TYPE
CMAKE_C_COMPILER
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_COMPILER
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if
(
flag
)
list
(
APPEND cmake_params -D
${
flag
}
:STRING=
${${
flag
}}
)
endif
()
endforeach
()
if
(
APPLE
)
list
(
APPEND cmake_params
-DCMAKE_OSX_ARCHITECTURES:STRING=
${
CMAKE_OSX_ARCHITECTURES
}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=
${
CMAKE_OSX_DEPLOYMENT_TARGET
}
-DCMAKE_OSX_SYSROOT:PATH=
${
CMAKE_OSX_SYSROOT
}
)
endif
()
#get extra-cmake args from every dependent project, if any.
set
(
arg_DEPENDS
)
get_project_depends
(
${
name
}
arg
)
foreach
(
dependency IN LISTS arg_DEPENDS
)
get_property
(
args GLOBAL PROPERTY
${
dependency
}
_CMAKE_ARGS
)
list
(
APPEND cmake_params
${
args
}
)
endforeach
()
# get extra flags added using append_flags(), if any.
set
(
extra_c_flags
)
set
(
extra_cxx_flags
)
foreach
(
dependency IN LISTS arg_DEPENDS
)
get_property
(
_tmp GLOBAL PROPERTY
${
dependency
}
_APPEND_FLAGS_CMAKE_C_FLAGS
)
set
(
extra_c_flags
${
extra_c_flags
}
${
_tmp
}
)
get_property
(
_tmp GLOBAL PROPERTY
${
dependency
}
_APPEND_FLAGS_CMAKE_CXX_FLAGS
)
set
(
extra_cxx_flags
${
extra_cxx_flags
}
${
_tmp
}
)
endforeach
()
set
(
project_c_flags
"
${
cflags
}
"
)
if
(
extra_c_flags
)
set
(
project_c_flags
"
${
cflags
}
${
extra_c_flags
}
"
)
endif
()
set
(
project_cxx_flags
"
${
cxxflags
}
"
)
if
(
extra_cxx_flags
)
set
(
project_cxx_flags
"
${
cxxflags
}
${
extra_cxx_flags
}
"
)
endif
()
#if (name STREQUAL "paraview")
# message("${ARGN}")
#endif()
# refer to documentation for PASS_LD_LIBRARY_PATH_FOR_BUILDS in
# in root CMakeLists.txt.
set
(
ld_library_path_argument
)
if
(
PASS_LD_LIBRARY_PATH_FOR_BUILDS
)
set
(
ld_library_path_argument
LD_LIBRARY_PATH
"
${
ld_library_path
}
"
)
endif
()
#args needs to be quoted so that empty list items aren't removed
#if that happens options like INSTALL_COMMAND "" won't work
set
(
args
"
${
ARGN
}
"
)
PVExternalProject_Add
(
${
name
}
"
${
args
}
"
PREFIX
${
name
}
DOWNLOAD_DIR
${
download_location
}
INSTALL_DIR
${
install_location
}
# add url/mdf/git-repo etc. specified in versions.cmake
${${
name
}
_revision
}
PROCESS_ENVIRONMENT
LDFLAGS
"
${
ldflags
}
"
CPPFLAGS
"
${
cppflags
}
"
CXXFLAGS
"
${
project_cxx_flags
}
"
CFLAGS
"
${
project_c_flags
}
"
# disabling this since it fails when building numpy.
# MACOSX_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}"
${
ld_library_path_argument
}
CMAKE_PREFIX_PATH
"
${
prefix_path
}
"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=
${
prefix_path
}
-DCMAKE_PREFIX_PATH:PATH=
${
prefix_path
}
-DCMAKE_C_FLAGS:STRING=
${
project_c_flags
}
-DCMAKE_CXX_FLAGS:STRING=
${
project_cxx_flags
}
-DCMAKE_SHARED_LINKER_FLAGS:STRING=
${
ldflags
}
${
cmake_params
}
)
get_property
(
additional_steps GLOBAL PROPERTY
${
name
}
_STEPS
)
if
(
additional_steps
)
foreach
(
step
${
additional_steps
}
)
get_property
(
step_contents GLOBAL PROPERTY
${
name
}
-STEP-
${
step
}
)
ExternalProject_Add_Step
(
${
name
}
${
step
}
${
step_contents
}
)
endforeach
()
endif
()
endfunction
()
macro
(
add_extra_cmake_args
)
if
(
build-projects
)
if
(
NOT cm-project
)
message
(
AUTHOR_WARNING
"add_extra_cmake_args called an incorrect stage."
)
return
()
endif
()
set_property
(
GLOBAL APPEND PROPERTY
${
cm-project
}
_CMAKE_ARGS
${
ARGN
}
)
else
()
# nothing to do.
endif
()
endmacro
()
#------------------------------------------------------------------------------
# in case of OpenMPI on Windows, for example, we need to pass extra compiler
# flags when building projects that use MPI. This provides an experimental
# mechanism for the same.
macro
(
append_flags key value
)
if
(
NOT
"
${
key
}
"
STREQUAL
"CMAKE_CXX_FLAGS"
AND NOT
"
${
key
}
"
STREQUAL
"CMAKE_C_FLAGS"
)
message
(
AUTHOR_WARNING
"Currently, only CMAKE_CXX_FLAGS and CMAKE_C_FLAGS are supported."
)
endif
()
if
(
build-projects
)
if
(
NOT cm-project
)
message
(
AUTHOR_WARNING
"add_extra_cmake_args called an incorrect stage."
)
return
()
endif
()
set_property
(
GLOBAL APPEND PROPERTY
${
cm-project
}
_APPEND_FLAGS_
${
key
}
"
${
value
}
"
)
else
()
# nothing to do.
endif
()
endmacro
()
#------------------------------------------------------------------------------
macro
(
add_external_project_step name
)
if
(
build-projects
)
if
(
NOT cm-project
)
message
(
AUTHOR_WARNING
"add_external_project_step called an incorrect stage."
)
return
()
endif
()
set_property
(
GLOBAL APPEND PROPERTY
${
cm-project
}
_STEPS
"
${
name
}
"
)
set_property
(
GLOBAL APPEND PROPERTY
${
cm-project
}
-STEP-
${
name
}
${
ARGN
}
)
else
()
# nothing to do.
endif
()
endmacro
()
CMake/TopologicalSort.cmake
deleted
100644 → 0
View file @
1b517456
# Perform a reverse topological sort on the given LIST.
#
# topological_sort(my_list "MY_" "_EDGES")
#
# LIST is the name of a variable containing a list of elements to be
# sorted in reverse topological order. Each element in the list has a
# set of outgoing edges (for example, those other list elements that
# it depends on). In the resulting reverse topological ordering
# (written back into the variable named LIST), an element will come
# later in the list than any of the elements that can be reached by
# following its outgoing edges and the outgoing edges of any vertices
# they target, recursively. Thus, if the edges represent dependencies
# on build targets, for example, the reverse topological ordering is
# the order in which one would build those targets.
#
# For each element E in this list, the edges for E are contained in
# the variable named ${PREFIX}${E}${SUFFIX}. If no such variable
# exists, then it is assumed that there are no edges. For example, if
# my_list contains a, b, and c, one could provide a dependency graph
# using the following variables:
#
# MY_A_EDGES b
# MY_B_EDGES
# MY_C_EDGES a b
#
# With the involcation of topological_sort shown above and these
# variables, the resulting reverse topological ordering will be b, a,
# c.
##############################################################################
# Modified from Boost Utilities
#
# Copyright 2010 Kitware, Inc.
##############################################################################
# Copyright 2007 Douglas Gregor <doug.gregor@gmail.com>
# Copyright 2007 Troy Straszheim
#
# Distributed under the Boost Software License, Version 1.0.
##############################################################################
# Boost Software License - Version 1.0 - August 17th, 2003
#
# Permission is hereby granted, free of charge, to any person or organization