From f72873541c23de8d4a0707603a5fd08b9437270a Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> Date: Thu, 23 Feb 2017 17:14:54 +0100 Subject: [PATCH 1/2] Made the lhapdf-sanitized.cmake code a bit more forgiving. So that it wouldn't bomb the installation completely when/if the build of Lhapdf fails. --- .../Lhapdf/cmake/lhapdf-sanitizer.cmake.in | 92 +++++++++++-------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in b/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in index 45bdaa1a..aed4044d 100644 --- a/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in +++ b/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in @@ -8,54 +8,68 @@ set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/@CMAKE_INSTALL_BINDIR@/lhapdf-config" ) -# Read in the generated configuration file: -file( READ ${_fileName} _content LIMIT 20000000 ) +# Check if the file exists: +if( EXISTS ${_fileName} ) -# Replace all occurences of the build directory with the installation path -# in the configuration file: -set( _outputContent ) -foreach( _element ${_content} ) - # Do the replacement: - string( REPLACE "@_buildDir@" "\${@CMAKE_PROJECT_NAME@_DIR}" - _newContent ${_element} ) - # It's done like this to make it clear to CMake that the semicolon - # is to be kept in the string. And not to be used as a list separator. - if( _outputContent ) - set( _outputContent "${_outputContent}\;${_newContent}" ) - else() - set( _outputContent "${_newContent}" ) - endif() -endforeach() + # Read in the generated configuration file: + file( READ ${_fileName} _content LIMIT 20000000 ) -# Overwrite the original file: -file( WRITE ${_fileName} ${_outputContent} ) + # Replace all occurences of the build directory with the installation path + # in the configuration file: + set( _outputContent ) + foreach( _element ${_content} ) + # Do the replacement: + string( REPLACE "@_buildDir@" "\${@CMAKE_PROJECT_NAME@_DIR}" + _newContent ${_element} ) + # It's done like this to make it clear to CMake that the semicolon + # is to be kept in the string. And not to be used as a list separator. + if( _outputContent ) + set( _outputContent "${_outputContent}\;${_newContent}" ) + else() + set( _outputContent "${_newContent}" ) + endif() + endforeach() + + # Overwrite the original file: + file( WRITE ${_fileName} ${_outputContent} ) + +else() + message( WARNING "Didn't find file: ${_fileName}" ) +endif() # The second file to patch: set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/@CMAKE_INSTALL_BINDIR@/lhapdf" ) -# Read in the generated configuration file: -file( READ ${_fileName} _content LIMIT 20000000 ) +# Check if the file exists: +if( EXISTS ${_fileName} ) + + # Read in the generated configuration file: + file( READ ${_fileName} _content LIMIT 20000000 ) + + # Replace all occurences of the build directory with the installation path + # in the configuration file: + set( _outputContent ) + foreach( _element ${_content} ) + # Do the replacement: + string( REGEX REPLACE "configured_datadir = '[^\n]*\n" + "configured_datadir = os.environ['@CMAKE_PROJECT_NAME@_DIR'] + '/share/LHAPDF'\n" + _newContent ${_element} ) + # It's done like this to make it clear to CMake that the semicolon + # is to be kept in the string. And not to be used as a list separator. + if( _outputContent ) + set( _outputContent "${_outputContent}\;${_newContent}" ) + else() + set( _outputContent "${_newContent}" ) + endif() + endforeach() -# Replace all occurences of the build directory with the installation path -# in the configuration file: -set( _outputContent ) -foreach( _element ${_content} ) - # Do the replacement: - string( REGEX REPLACE "configured_datadir = '[^\n]*\n" - "configured_datadir = os.environ['@CMAKE_PROJECT_NAME@_DIR'] + '/share/LHAPDF'\n" - _newContent ${_element} ) - # It's done like this to make it clear to CMake that the semicolon - # is to be kept in the string. And not to be used as a list separator. - if( _outputContent ) - set( _outputContent "${_outputContent}\;${_newContent}" ) - else() - set( _outputContent "${_newContent}" ) - endif() -endforeach() + # Overwrite the original file: + file( WRITE ${_fileName} ${_outputContent} ) -# Overwrite the original file: -file( WRITE ${_fileName} ${_outputContent} ) +else() + message( WARNING "Didn't find file: ${_fileName}" ) +endif() # Clean up: unset( _fileName ) -- GitLab From ca338dddea3bf225b2ced0429bffb5b8286b3143 Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> Date: Thu, 23 Feb 2017 17:15:45 +0100 Subject: [PATCH 2/2] Fixed the installation of Python. So that child projects could actually pick it up for their own build... --- External/Python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/Python/CMakeLists.txt b/External/Python/CMakeLists.txt index 8d1f6550..561990af 100644 --- a/External/Python/CMakeLists.txt +++ b/External/Python/CMakeLists.txt @@ -46,5 +46,5 @@ ExternalProject_Add( Python add_dependencies( Package_Python Python ) # Install Python: -install( DIRECTORY ${_buildDir} +install( DIRECTORY ${_buildDir}/ DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL ) -- GitLab