[brlcad-commits] SF.net SVN: brlcad:[49863] brlcad/trunk/CMakeLists.txt
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2012-04-01 05:02:38
|
Revision: 49863 http://brlcad.svn.sourceforge.net/brlcad/?rev=49863&view=rev Author: starseeker Date: 2012-04-01 05:02:31 +0000 (Sun, 01 Apr 2012) Log Message: ----------- Use LIB_DIR instead of hardcoding lib in the ignore path logic Modified Paths: -------------- brlcad/trunk/CMakeLists.txt Modified: brlcad/trunk/CMakeLists.txt =================================================================== --- brlcad/trunk/CMakeLists.txt 2012-04-01 04:52:54 UTC (rev 49862) +++ brlcad/trunk/CMakeLists.txt 2012-04-01 05:02:31 UTC (rev 49863) @@ -149,6 +149,7 @@ endif(BRLCAD_USER_GLOBAL_CONFIG_FILE) endif(BRLCAD_USER_GLOBAL_CONFIG_FILE AND EXISTS ${BRLCAD_USER_GLOBAL_CONFIG_FILE}) +#--------------------------------------------------------------------- # Allow the BRLCAD_ROOT environment variable to set CMAKE_INSTALL_PREFIX # but be noisy about it. This is generally not a good idea. find_program(SLEEP_EXEC sleep) @@ -191,68 +192,7 @@ endif(SLEEP_EXEC) endif(BRLCAD_DATA_ENV) -# Searching the system for packages presents something of a dilemma - -# in most situations it is Very Bad for a BRL-CAD build to be using -# older versions of libraries in install directories as search results. -# Generally, the desired behavior is to ignore whatever libraries are -# in the install directories, and only use external library results if -# they are something already found on the system due to non-BRL-CAD -# installation (source compile, package managers, etc.). Unfortunately, -# CMake's standard behavior is to add a CMAKE_INSTALL_PREFIX to the -# search path once defined, resulting in (for us) an unexpected behavior -# of returning old installed libraries when CMake is re-run in a -# directory. -# -# To work around this, there are two possible approaches. One, -# identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH: -# -# http://www.cmake.org/pipermail/cmake/2010-October/040292.html -# -# The other, pointed out by Michael Hertling, uses the -# CMake_[SYSTEM_]IGNORE_PATH variables. -# -# http://www.cmake.org/pipermail/cmake/2011-May/044503.html -# -# BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has -# switched to using the *_IGNORE_PATH variables. This requires -# CMake 2.8.3 or later. -# -# The complication with ignoring install paths is if we are -# installing to a "legitimate" system search path - i.e. our -# CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate -# search target for find_package. In this case, we can't exclude -# accidental hits on our libraries without also excluding legitimate -# find_package results. So the net results are: -# -# 1. If you are planning to install to a system directory (typically -# a bad idea but the settings are legal) clean out the old system -# first or accept that the old libraries will be found and used. -# -# 2. For more custom paths, the logic below will avoid the value -# of CMAKE_INSTALL_PREFIX in find_package searches -# -# (Note: CMAKE_INSTALL_PREFIX must be checked in the case where someone -# sets it on the command line prior to CMake being run. BRLCAD_PREFIX -# preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run. -# CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context -# when CMake is re-run unless specified explicitly on the command line. -# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value -# is available, BRLCAD_PREFIX is used to store the value in the cache.) - -if(CMAKE_INSTALL_PREFIX) - if(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") - get_filename_component(PATH_NORMALIZED ${CMAKE_INSTALL_PREFIX}/lib ABSOLUTE) - set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) - endif(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") -endif(CMAKE_INSTALL_PREFIX) -if(BRLCAD_PREFIX) - if(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") - get_filename_component(PATH_NORMALIZED ${BRLCAD_PREFIX}/lib ABSOLUTE) - set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) - endif(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") -endif(BRLCAD_PREFIX) -mark_as_advanced(CMAKE_SYSTEM_IGNORE_PATH) - +#--------------------------------------------------------------------- # Load general utility routines for BRL-CAD CMake logic include(${CMAKE_SOURCE_DIR}/misc/CMake/BRLCAD_Util.cmake) @@ -317,8 +257,69 @@ set(DOC_DIR doc) endif(NOT DOC_DIR) +#--------------------------------------------------------------------- +# Searching the system for packages presents something of a dilemma - +# in most situations it is Very Bad for a BRL-CAD build to be using +# older versions of libraries in install directories as search results. +# Generally, the desired behavior is to ignore whatever libraries are +# in the install directories, and only use external library results if +# they are something already found on the system due to non-BRL-CAD +# installation (source compile, package managers, etc.). Unfortunately, +# CMake's standard behavior is to add CMAKE_INSTALL_PREFIX to the search +# path once defined, resulting in (for us) the unexpected behavior of +# returning old installed libraries when CMake is re-run in a directory. +# +# To work around this, there are two possible approaches. One, +# identified by Maik Beckmann, operates on CMAKE_SYSTEM_PREFIX_PATH: +# +# http://www.cmake.org/pipermail/cmake/2010-October/040292.html +# +# The other, pointed out by Michael Hertling, uses the +# CMake_[SYSTEM_]IGNORE_PATH variables. +# +# http://www.cmake.org/pipermail/cmake/2011-May/044503.html +# +# BRL-CAD initially operated on CMAKE_SYSTEM_PREFIX_PATH, but has +# switched to using the *_IGNORE_PATH variables. This requires +# CMake 2.8.3 or later. +# +# The complication with ignoring install paths is if we are +# installing to a "legitimate" system search path - i.e. our +# CMAKE_INSTALL_PREFIX value is standard enough that it is a legitimate +# search target for find_package. In this case, we can't exclude +# accidental hits on our libraries without also excluding legitimate +# find_package results. So the net results are: +# +# 1. If you are planning to install to a system directory (typically +# a bad idea but the settings are legal) clean out the old system +# first or accept that the old libraries will be found and used. +# +# 2. For more custom paths, the logic below will avoid the value +# of CMAKE_INSTALL_PREFIX in find_package searches +# +# (Note: CMAKE_INSTALL_PREFIX must be checked in the case where someone +# sets it on the command line prior to CMake being run. BRLCAD_PREFIX +# preserves the CMAKE_INSTALL_PREFIX setting from the previous CMake run. +# CMAKE_INSTALL_PREFIX does not seem to be immediately set in this context +# when CMake is re-run unless specified explicitly on the command line. +# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value +# is available, BRLCAD_PREFIX is used to store the value in the cache.) +if(CMAKE_INSTALL_PREFIX) + if(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") + get_filename_component(PATH_NORMALIZED ${CMAKE_INSTALL_PREFIX}/${LIB_DIR} ABSOLUTE) + set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) + endif(NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr" AND NOT ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") +endif(CMAKE_INSTALL_PREFIX) +if(BRLCAD_PREFIX) + if(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") + get_filename_component(PATH_NORMALIZED ${BRLCAD_PREFIX}/${LIB_DIR} ABSOLUTE) + set(CMAKE_SYSTEM_IGNORE_PATH ${PATH_NORMALIZED}) + endif(NOT ${BRLCAD_PREFIX} STREQUAL "/usr" AND NOT ${BRLCAD_PREFIX} STREQUAL "/usr/local") +endif(BRLCAD_PREFIX) +mark_as_advanced(CMAKE_SYSTEM_IGNORE_PATH) + #--------------------------------------------------------------------- # By default (as of version 2.8.2) CMake does not provide access to # global lists of executable and library targets. This is useful This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |