diff --git a/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in b/External/Lhapdf/cmake/lhapdf-sanitizer.cmake.in index 45bdaa1afbf8e3ef0f0e17cd5021c293b012301d..aed4044d3b8666303f62cc85a7de984bc066e72c 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 ) diff --git a/External/Python/CMakeLists.txt b/External/Python/CMakeLists.txt index 8d1f6550f0f3c37bc2cc3a35a76416f37fa4ca86..561990afd505b78220e046619f791d2c2f2a1aaf 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 )