diff --git a/CMake/ITKModuleExternal.cmake b/CMake/ITKModuleExternal.cmake index 0aa1b236f31..c750c7d65c0 100644 --- a/CMake/ITKModuleExternal.cmake +++ b/CMake/ITKModuleExternal.cmake @@ -75,55 +75,18 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR "lib") endif() -# The default path when not wrapping. Restore standard build location -# if python wrapping is turned on, and then turned off. +# When Wrapping is enabled the CMAKE_*_OUTPUT_DIRECTORY(s) will be explicitly set +include(WrappingConfigCommon) + +# Only set default if not prior configured by wrapping or the user if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set( - NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} - CACHE PATH - "Shared library directory" - ) -else() - set( - NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - CACHE PATH - "Shared library directory" - ) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) endif() if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set( - NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${ITK_BINARY_DIR}/bin - CACHE PATH - "Shared library directory" - ) -else() - set( - NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - CACHE PATH - "Shared library directory" - ) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/bin) endif() - -include(WrappingConfigCommon) -# Setup build locations for shared libraries ----STOP - if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - set( - CMAKE_ARCHIVE_OUTPUT_DIRECTORY - ${ITK_DIR}/${CMAKE_INSTALL_LIBDIR} - CACHE PATH - "Static library install directory" - ) - set( - CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY} - CACHE PATH - "Runtime library directory" - ) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) endif() # ITK installation structure diff --git a/CMake/WrappingConfigCommon.cmake b/CMake/WrappingConfigCommon.cmake index 84d1e576dae..3ab2272840e 100644 --- a/CMake/WrappingConfigCommon.cmake +++ b/CMake/WrappingConfigCommon.cmake @@ -41,40 +41,8 @@ if(ITK_WRAPPING) # When wrapping, the multi-config generators can only be used in degraded state # of allowing only a single element int the CMAKE_CONFIGURATION_TYPES and enforcing # that CMAKE_BUILD_TYPE match that type (see Wrapping/CMakeLists.txt enforcement) - set( - CMAKE_LIBRARY_OUTPUT_DIRECTORY - "$<1:${ITK_PYTHON_PACKAGE_DIR}>" - CACHE PATH - "Shared library directory with generator override" - FORCE - ) - set( - CMAKE_RUNTIME_OUTPUT_DIRECTORY - "$<1:${ITK_PYTHON_PACKAGE_DIR}>" - CACHE PATH - "Shared library directory with generator override" - FORCE - ) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "$<1:${ITK_PYTHON_PACKAGE_DIR}>") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "$<1:${ITK_PYTHON_PACKAGE_DIR}>") endif() -else() - set( - CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY} - CACHE PATH - "Shared library directory" - ) - set( - CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY} - CACHE PATH - "Runtime library directory" - ) endif() -mark_as_advanced( - FORCE - CMAKE_RUNTIME_OUTPUT_DIRECTORY - CMAKE_LIBRARY_OUTPUT_DIRECTORY - NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY - NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY - Python3_ROOT_DIR -) +mark_as_advanced(FORCE Python3_ROOT_DIR) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8050af1e14a..988ea72ad77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,44 +345,22 @@ if(NOT DEFINED CMAKE_FIND_USE_PACKAGE_REGISTRY) set(CMAKE_FIND_USE_PACKAGE_REGISTRY 0) endif() -# Setup build locations for shared libraries ----START -# ITK/CMakeLists.txt -- use ITK_BINARY_DIR as root -# ITK/CMake/ITKModuleExternal.cmake -- use ITK_DIR as root +# Setup build locations for libraries ----START # -# The default path when not wrapping. Restore standard build location -# if python wrapping is turned on, and then turned off. +# When Wrapping is enabled the CMAKE_*_OUTPUT_DIRECTORY(s) will be explicitly set +include(WrappingConfigCommon) + +# Only set default is not prior configured by wrapping or the user if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set( - NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} - CACHE PATH - "Shared library directory" - ) -else() - set( - NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - CACHE PATH - "Shared library directory" - ) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) endif() if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set( - NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${ITK_BINARY_DIR}/bin - CACHE PATH - "Shared library directory" - ) -else() - set( - NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - CACHE PATH - "Shared library directory" - ) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/bin) +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) endif() -include(WrappingConfigCommon) # Setup build locations for shared libraries ----STOP if(CMAKE_CONFIGURATION_TYPES AND ITK_WRAPPING) @@ -399,9 +377,6 @@ if(CMAKE_CONFIGURATION_TYPES AND ITK_WRAPPING) ) endif() -if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -endif() set(ITK_MODULES_DIR "${ITK_BINARY_DIR}/${ITK_INSTALL_PACKAGE_DIR}/Modules") #----------------------------------------------------------------------------- diff --git a/Wrapping/CMakeLists.txt b/Wrapping/CMakeLists.txt index 2e4f2b59020..1f4d8c95cd3 100644 --- a/Wrapping/CMakeLists.txt +++ b/Wrapping/CMakeLists.txt @@ -60,22 +60,8 @@ set( ) if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - # See ITK/CMakeLists.txt for rational for overwriting multi-config default behavior of appending $ - set( - CMAKE_LIBRARY_OUTPUT_DIRECTORY - "$<1:${WrapITK_BINARY_DIR}/lib>" - CACHE INTERNAL - "Single output directory for building all libraries." - ) -endif() - -if(NOT EXECUTABLE_OUTPUT_PATH) - set( - EXECUTABLE_OUTPUT_PATH - ${WrapITK_BINARY_DIR}/bin - CACHE INTERNAL - "Single output directory for building all executables." - ) + # See ITK/WrappingConfigCommon.cmake for rational for overwriting multi-config default behavior of appending $ + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "$<1:${WrapITK_BINARY_DIR}/lib>") endif() # Set WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER to a non-null value, like @@ -97,12 +83,9 @@ endif() mark_as_advanced( CMAKE_LIBRARY_OUTPUT_DIRECTORY - EXECUTABLE_OUTPUT_PATH WRAP_ITK_INSTALL_PREFIX ) -set(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) - ############################################################################### # Additional files for installation ###############################################################################