Skip to content

Commit 160dbfd

Browse files
authored
Merge pull request InsightSoftwareConsortium#5691 from blowekamp/no_cache_output_directory
Use normal cmake variables for output directories
2 parents 33d9c35 + ffaa0c9 commit 160dbfd

File tree

4 files changed

+22
-133
lines changed

4 files changed

+22
-133
lines changed

CMake/ITKModuleExternal.cmake

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -75,55 +75,18 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
7575
set(CMAKE_INSTALL_LIBDIR "lib")
7676
endif()
7777

78-
# The default path when not wrapping. Restore standard build location
79-
# if python wrapping is turned on, and then turned off.
78+
# When Wrapping is enabled the CMAKE_*_OUTPUT_DIRECTORY(s) will be explicitly set
79+
include(WrappingConfigCommon)
80+
81+
# Only set default if not prior configured by wrapping or the user
8082
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
81-
set(
82-
NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY
83-
${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
84-
CACHE PATH
85-
"Shared library directory"
86-
)
87-
else()
88-
set(
89-
NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY
90-
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
91-
CACHE PATH
92-
"Shared library directory"
93-
)
83+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
9484
endif()
9585
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
96-
set(
97-
NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY
98-
${ITK_BINARY_DIR}/bin
99-
CACHE PATH
100-
"Shared library directory"
101-
)
102-
else()
103-
set(
104-
NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY
105-
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
106-
CACHE PATH
107-
"Shared library directory"
108-
)
86+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/bin)
10987
endif()
110-
111-
include(WrappingConfigCommon)
112-
# Setup build locations for shared libraries ----STOP
113-
11488
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
115-
set(
116-
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
117-
${ITK_DIR}/${CMAKE_INSTALL_LIBDIR}
118-
CACHE PATH
119-
"Static library install directory"
120-
)
121-
set(
122-
CMAKE_RUNTIME_OUTPUT_DIRECTORY
123-
${NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY}
124-
CACHE PATH
125-
"Runtime library directory"
126-
)
89+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
12790
endif()
12891

12992
# ITK installation structure

CMake/WrappingConfigCommon.cmake

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,8 @@ if(ITK_WRAPPING)
4141
# When wrapping, the multi-config generators can only be used in degraded state
4242
# of allowing only a single element int the CMAKE_CONFIGURATION_TYPES and enforcing
4343
# that CMAKE_BUILD_TYPE match that type (see Wrapping/CMakeLists.txt enforcement)
44-
set(
45-
CMAKE_LIBRARY_OUTPUT_DIRECTORY
46-
"$<1:${ITK_PYTHON_PACKAGE_DIR}>"
47-
CACHE PATH
48-
"Shared library directory with generator override"
49-
FORCE
50-
)
51-
set(
52-
CMAKE_RUNTIME_OUTPUT_DIRECTORY
53-
"$<1:${ITK_PYTHON_PACKAGE_DIR}>"
54-
CACHE PATH
55-
"Shared library directory with generator override"
56-
FORCE
57-
)
44+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "$<1:${ITK_PYTHON_PACKAGE_DIR}>")
45+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "$<1:${ITK_PYTHON_PACKAGE_DIR}>")
5846
endif()
59-
else()
60-
set(
61-
CMAKE_LIBRARY_OUTPUT_DIRECTORY
62-
${NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY}
63-
CACHE PATH
64-
"Shared library directory"
65-
)
66-
set(
67-
CMAKE_RUNTIME_OUTPUT_DIRECTORY
68-
${NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY}
69-
CACHE PATH
70-
"Runtime library directory"
71-
)
7247
endif()
73-
mark_as_advanced(
74-
FORCE
75-
CMAKE_RUNTIME_OUTPUT_DIRECTORY
76-
CMAKE_LIBRARY_OUTPUT_DIRECTORY
77-
NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY
78-
NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY
79-
Python3_ROOT_DIR
80-
)
48+
mark_as_advanced(FORCE Python3_ROOT_DIR)

CMakeLists.txt

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -345,44 +345,22 @@ if(NOT DEFINED CMAKE_FIND_USE_PACKAGE_REGISTRY)
345345
set(CMAKE_FIND_USE_PACKAGE_REGISTRY 0)
346346
endif()
347347

348-
# Setup build locations for shared libraries ----START
349-
# ITK/CMakeLists.txt -- use ITK_BINARY_DIR as root
350-
# ITK/CMake/ITKModuleExternal.cmake -- use ITK_DIR as root
348+
# Setup build locations for libraries ----START
351349
#
352-
# The default path when not wrapping. Restore standard build location
353-
# if python wrapping is turned on, and then turned off.
350+
# When Wrapping is enabled the CMAKE_*_OUTPUT_DIRECTORY(s) will be explicitly set
351+
include(WrappingConfigCommon)
352+
353+
# Only set default is not prior configured by wrapping or the user
354354
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
355-
set(
356-
NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY
357-
${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
358-
CACHE PATH
359-
"Shared library directory"
360-
)
361-
else()
362-
set(
363-
NO_WRAP_CMAKE_LIBRARY_OUTPUT_DIRECTORY
364-
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
365-
CACHE PATH
366-
"Shared library directory"
367-
)
355+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
368356
endif()
369357
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
370-
set(
371-
NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY
372-
${ITK_BINARY_DIR}/bin
373-
CACHE PATH
374-
"Shared library directory"
375-
)
376-
else()
377-
set(
378-
NO_WRAP_CMAKE_RUNTIME_OUTPUT_DIRECTORY
379-
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
380-
CACHE PATH
381-
"Shared library directory"
382-
)
358+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/bin)
359+
endif()
360+
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
361+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
383362
endif()
384363

385-
include(WrappingConfigCommon)
386364
# Setup build locations for shared libraries ----STOP
387365

388366
if(CMAKE_CONFIGURATION_TYPES AND ITK_WRAPPING)
@@ -399,9 +377,6 @@ if(CMAKE_CONFIGURATION_TYPES AND ITK_WRAPPING)
399377
)
400378
endif()
401379

402-
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
403-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ITK_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
404-
endif()
405380
set(ITK_MODULES_DIR "${ITK_BINARY_DIR}/${ITK_INSTALL_PACKAGE_DIR}/Modules")
406381

407382
#-----------------------------------------------------------------------------

Wrapping/CMakeLists.txt

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,8 @@ set(
6060
)
6161

6262
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
63-
# See ITK/CMakeLists.txt for rational for overwriting multi-config default behavior of appending $<CONFIG>
64-
set(
65-
CMAKE_LIBRARY_OUTPUT_DIRECTORY
66-
"$<1:${WrapITK_BINARY_DIR}/lib>"
67-
CACHE INTERNAL
68-
"Single output directory for building all libraries."
69-
)
70-
endif()
71-
72-
if(NOT EXECUTABLE_OUTPUT_PATH)
73-
set(
74-
EXECUTABLE_OUTPUT_PATH
75-
${WrapITK_BINARY_DIR}/bin
76-
CACHE INTERNAL
77-
"Single output directory for building all executables."
78-
)
63+
# See ITK/WrappingConfigCommon.cmake for rational for overwriting multi-config default behavior of appending $<CONFIG>
64+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "$<1:${WrapITK_BINARY_DIR}/lib>")
7965
endif()
8066

8167
# Set WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER to a non-null value, like
@@ -97,12 +83,9 @@ endif()
9783

9884
mark_as_advanced(
9985
CMAKE_LIBRARY_OUTPUT_DIRECTORY
100-
EXECUTABLE_OUTPUT_PATH
10186
WRAP_ITK_INSTALL_PREFIX
10287
)
10388

104-
set(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
105-
10689
###############################################################################
10790
# Additional files for installation
10891
###############################################################################

0 commit comments

Comments
 (0)