find_path/find_library behaviour changed between 3.8.2 and 3.9.0
Hi,
We (ATLAS Experiment, http://cern.ch/atlas) have just discovered an extremely inconvenient change in the behaviour of CMake with 3.9.0. Attached is an example (PathSearchOrder.tar.bz2 ) demonstrating the issue. (Sorry for the relatively complex example, I tried to simplify it a bit, but in a very simple example the issue didn't show up. So in the end I just decided to extract the exact code that we use in our project as-is.)
With CMake 3.8.2 I get:
[tcsh][pcadp02]:build > ~/work/public/cmake/3.8.2/x86_64-slc6/bin/cmake ../PathSearchOrder/
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using the LCG modules without setting up a release
-- Found CLHEP: /home/krasznaa/projects/searchOrder/PathSearchOrder/clhep1/include (found version "2.2.0.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/krasznaa/projects/searchOrder/build
While with 3.9.0:
[tcsh][pcadp02]:build > ~/work/public/cmake/3.9.0/x86_64-slc6/bin/cmake ../PathSearchOrder/
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using the LCG modules without setting up a release
-- Found CLHEP: /home/krasznaa/projects/searchOrder/PathSearchOrder/clhep2/include (found version "2.2.0.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/krasznaa/projects/searchOrder/build
As you'll see, the main CMakeLists.txt
file sets up the two paths with:
# Set up the two CLHEP search paths in two different ways:
set( ENV{CMAKE_PREFIX_PATH} "${CMAKE_SOURCE_DIR}/clhep1" )
set( CLHEP_ROOT "${CMAKE_SOURCE_DIR}/clhep2" )
Our own FindCLHEP.cmake
module is set up to respect the CLHEP_ROOT
variable while searching for CLHEP. But our code was written to assume that CMAKE_PREFIX_PATH
would be searched first. This is a very important assumption in our code.
Was this change in 3.9.0 intentional? I assume not, because with a configuration that sets CMAKE_PREFIX_PATH
and CLHEP_ROOT
in the same file that then calls find_path
, the issue doesn't seem to show up. The difference is only visible in such a more complex setup.
This unfortunately makes all of our existing software releases unusable with CMake 3.9.0. So we'd very much like a resolution to this where we get the previous behaviour back. Otherwise we'll be in some serious trouble.
Cheers, Attila