diff --git a/Build/AtlasCMake/modules/AtlasInstallFunctions.cmake b/Build/AtlasCMake/modules/AtlasInstallFunctions.cmake index a386a24b03d3b35932eb6343993ca62f3ef894e7..002ce68f61505edf645c206ee4371025d70ca5a8 100644 --- a/Build/AtlasCMake/modules/AtlasInstallFunctions.cmake +++ b/Build/AtlasCMake/modules/AtlasInstallFunctions.cmake @@ -45,16 +45,19 @@ function( atlas_install_headers ) -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/include )" ) + # Command to create the include directory: + add_custom_command( OUTPUT ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} ) + # Loop over the specified directories: foreach( dir ${ARG_UNPARSED_ARGUMENTS} ) # Set up the installation of the header directory into the build area: file( RELATIVE_PATH _target ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/${dir} ) add_custom_command( OUTPUT ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/${dir} - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E create_symlink ${_target} - ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/${dir} ) + ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/${dir} + DEPENDS ${CMAKE_INCLUDE_OUTPUT_DIRECTORY} ) # Clean up on "make clean": set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES @@ -155,6 +158,10 @@ function( atlas_install_generic ) set( _installDest ${ARG_DESTINATION} ) endif() + # Command to create the build directory: + add_custom_command( OUTPUT ${_buildDest} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_buildDest} ) + # Now loop over all file names: foreach( _file ${_files} ) # Set up its installation into the build area: @@ -162,9 +169,9 @@ function( atlas_install_generic ) ${_buildDest} ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ) get_filename_component( _filename ${_file} NAME ) add_custom_command( OUTPUT ${_buildDest}/${_filename} - COMMAND ${CMAKE_COMMAND} -E make_directory ${_buildDest} COMMAND ${CMAKE_COMMAND} -E create_symlink ${_target} - ${_buildDest}/${_filename} ) + ${_buildDest}/${_filename} + DEPENDS ${_buildDest} ) set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${_buildDest}/${_filename} ) @@ -293,6 +300,10 @@ function( atlas_install_python_modules ) "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" ) set( _bytecodeDir "${_bytecodeDir}/pythonBytecode/${_path}" ) + # Command to create the bytecode directory: + add_custom_command( OUTPUT ${_bytecodeDir} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_bytecodeDir} ) + # Construct the bytecode's file name: set( _bytecode "${_bytecodeDir}/${_filename}.pyc" ) @@ -315,9 +326,8 @@ function( atlas_install_python_modules ) # Set up a custom command for generating the bytecode: add_custom_command( OUTPUT ${_bytecode} - COMMAND ${CMAKE_COMMAND} -E make_directory ${_bytecodeDir} COMMAND ${PYTHON_EXECUTABLE} ${_pycmdFile} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_pyFile}" + DEPENDS ${_bytecodeDir} "${CMAKE_CURRENT_SOURCE_DIR}/${_pyFile}" VERBATIM ) # Make our installation target call this custom command: @@ -356,8 +366,8 @@ function( atlas_install_python_modules ) # Get the file's name, without its (probably) .py extension: get_filename_component( _filename "${_file}" NAME_WE ) # Construct the bytecode's file name: - set( _bytecode - "${CMAKE_PYTHON_OUTPUT_DIRECTORY}/${pkgName}/${_filename}.pyc" ) + set( _bytecodeDir "${CMAKE_PYTHON_OUTPUT_DIRECTORY}/${pkgName}" ) + set( _bytecode "${_bytecodeDir}/${_filename}.pyc" ) # The python command to execute: set( _pycmd "import py_compile; py_compile.compile( " ) @@ -373,12 +383,14 @@ function( atlas_install_python_modules ) file( GENERATE OUTPUT ${_pycmdFile} CONTENT "${_pycmd}" ) + # Command to create the build directory: + add_custom_command( OUTPUT ${_bytecodeDir} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_bytecodeDir} ) + # Set up a custom command for generating the bytecode: add_custom_command( OUTPUT ${_bytecode} - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/${pkgName} COMMAND ${PYTHON_EXECUTABLE} ${_pycmdFile} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" + DEPENDS ${_bytecodeDir} "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" VERBATIM ) # Make our installation target call this custom command: @@ -395,6 +407,7 @@ function( atlas_install_python_modules ) # Clean up: unset( _filename ) + unset( _bytecodeDir ) unset( _bytecode ) unset( _pycmd ) unset( _bytecodeFname )