Skip to content

Commit 79a7111

Browse files
committed
Since bext is not expected to be system-installed outside of a BRL-CAD
build (and doesn't appear to be structured for it right now also), default CMAKE_INSTALL_PREFIX to the build directory (wherein it will create an install and noinstall subdirs). This addresses an issue where default bext builds with different configurations (e.g., Release and Debug) won't look by default into a common path (HOME/bext_output) and find other configuration products. This was problematic for non-enable-all builds and even existing partial builds since it would find and prefer to use the found version in install even with enable-all. The non-deterministic nature made for very difficult to reproduce and debug failure states as well. Another issue was the default surprise of having files written outside of the build dir, unspecified by the user. This was exacerbated on a system where build dir and home dir existed on different partitions with different capacity and performance characteristics.
1 parent 90642ca commit 79a7111

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

CMakeLists.txt

+8-19
Original file line numberDiff line numberDiff line change
@@ -122,29 +122,18 @@ endif(NOT DEFINED DATA_DIR)
122122
# directory to hold both of these outputs, and we want it to be in a standard
123123
# location that other projects will know to look for.
124124

125-
# Try to get the home directory
126-
set(ENV_HOME "$ENV{HOME}")
127-
if (NOT ENV_HOME)
128-
set(ENV_HOME "$ENV{USERPROFILE}")
129-
endif (NOT ENV_HOME)
130-
131-
# If we're not being forced to a specific location
132-
# and we know where home is, use it
125+
# Default to the build directory for output and installation
133126
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
134-
set(CMAKE_INSTALL_PREFIX "${ENV_HOME}")
127+
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "default install path" FORCE)
135128
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
136129

137-
# If home didn't work, fall back on the build directory
138-
if (NOT CMAKE_INSTALL_PREFIX)
139-
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
140-
endif (NOT CMAKE_INSTALL_PREFIX)
141-
142-
# Having decided on the path, make sure subsequent configures stick with it
130+
# Make sure subsequent configures stick with the same installation path, whether specified or not
143131
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Calculated or specified install prefix" FORCE)
144132

145-
set(BEXT_ROOT bext_output)
146-
set(CMAKE_BUNDLE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${BEXT_ROOT}/install" CACHE PATH "Outputs for bundling" FORCE)
147-
set(CMAKE_NOBUNDLE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${BEXT_ROOT}/noinstall" CACHE PATH "Build tools NOT intended for bundling" FORCE)
133+
message("prefix is ${CMAKE_INSTALL_PREFIX}")
134+
135+
set(CMAKE_BUNDLE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/install" CACHE PATH "Outputs for bundling" FORCE)
136+
set(CMAKE_NOBUNDLE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/noinstall" CACHE PATH "Build tools NOT intended for bundling" FORCE)
148137
file(MAKE_DIRECTORY "${CMAKE_BUNDLE_INSTALL_PREFIX}")
149138
file(MAKE_DIRECTORY "${CMAKE_NOBUNDLE_INSTALL_PREFIX}")
150139

@@ -512,7 +501,7 @@ endif (WIN32)
512501
###############################################################################
513502
# Report where we will be putting our output
514503
###############################################################################
515-
message("Output directory: ${CMAKE_INSTALL_PREFIX}/${BEXT_ROOT}")
504+
message("Output directory: ${CMAKE_INSTALL_PREFIX}")
516505

517506
# Local Variables:
518507
# tab-width: 8

0 commit comments

Comments
 (0)