Created attachment 396 [details] CMake file Hi, I build geant4 10.2.1 with external CLHEP 2.3.1.1. the building is successful. I get a Geant4Config.cmake that contains the path to CLHEP 273 # Builtin/External packages 274 set(Geant4_builtin_clhep_FOUND ) 275 if(NOT Geant4_builtin_clhep_FOUND) 276 set(Geant4_system_clhep_ISGRANULAR OFF) 277 278 set(CLHEP_ROOT_DIR "/Users/mpetric/Desktop/CI/clhep-2.3.1.1") 279 find_package(CLHEP 2.3.1.1 REQUIRED ) 280 unset(CLHEP_ROOT_DIR) 281 #CLHEP doesn't use target properties fully yet, so always include_directories 282 include_directories(${CLHEP_INCLUDE_DIRS}) 283 endif() So at this point geant knows where CLHEP is and I don't in practice need to worry about this if I use include(${Geant4_USE_FILE}). However I observe a rather strange behavior. I have attached the CMakeList.txt and I am trying to build a simple example.cpp containing only ===== example.cpp #include <CLHEP/Matrix/Matrix.h> int main(int argc,char** argv) { CLHEP::HepMatrix a; return 0; } ===== We first have an empty environment then we source __path_to__/geant4.10.02.p01/bin/geant4.sh and then execute cmake on the attached CMakeList which results in cmake --trace-expand complaining ======================================================================================================================= /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(261): list(GET _g4dataset_tuple 2 Geant4_DATASET_G4ENSDFSTATE_PATH ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(263): unset(Geant4_DATASET_DESCRIPTIONS ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(274): set(Geant4_builtin_clhep_FOUND ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(275): if(NOT Geant4_builtin_clhep_FOUND ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(276): set(Geant4_system_clhep_ISGRANULAR OFF ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(278): set(CLHEP_ROOT_DIR /Users/mpetric/Desktop/CI/clhep-2.3.1.1 ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(279): find_package(CLHEP 2.3.1.1 REQUIRED ) CMake Error at /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake:279 (find_package): By not providing "FindCLHEP.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "CLHEP", but CMake did not find one. Could not find a package configuration file provided by "CLHEP" (requested version 2.3.1.1) with any of the following names: CLHEPConfig.cmake clhep-config.cmake Add the installation prefix of "CLHEP" to CMAKE_PREFIX_PATH or set "CLHEP_DIR" to a directory containing one of the above files. If "CLHEP" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:4 (find_package) ======================================================================================================================= So the cmake sets set(CLHEP_ROOT_DIR /Users/mpetric/Desktop/CI/clhep-2.3.1.1 ) but the find package does find clhep? The only way I get this to work is to add clhep-2.3.1.1/bin to the PATH, but then find_package automatically searches in the directories ============= <prefix>/ (W) <prefix>/(cmake|CMake)/ (W) <prefix>/<name>*/ (W) <prefix>/<name>*/(cmake|CMake)/ (W) <prefix>/(lib/<arch>|lib|share)/cmake/<name>*/ (U) <prefix>/(lib/<arch>|lib|share)/<name>*/ (U) <prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ (U) ============= https://cmake.org/cmake/help/v3.0/command/find_package.html This can also be seen from the cmake trace ======================================================================================================================= /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(274): set(Geant4_builtin_clhep_FOUND ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(275): if(NOT Geant4_builtin_clhep_FOUND ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(276): set(Geant4_system_clhep_ISGRANULAR OFF ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(278): set(CLHEP_ROOT_DIR /Users/mpetric/Desktop/CI/clhep-2.3.1.1 ) /Users/mpetric/Desktop/CI/geant4.10.02.p01/lib/Geant4-10.2.1/Geant4Config.cmake(279): find_package(CLHEP 2.3.1.1 REQUIRED ) /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(12): set(PACKAGE_VERSION 2.3.1.1 ) /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(15): if(2.3.1.1 VERSION_LESS 2.3.1.1 ) /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(17): else() /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(18): set(PACKAGE_VERSION_COMPATIBLE TRUE ) /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(19): if(2.3.1.1 VERSION_EQUAL 2.3.1.1 ) /Users/mpetric/Desktop/CI/clhep-2.3.1.1/lib/CLHEP-2.3.1.1/CLHEPConfigVersion.cmake(20): set(PACKAGE_VERSION_EXACT TRUE ) ======================================================================================================================= However the FindCLHEP.cmake provided in geant in lib/Geant4-10.2.1/Modules/FindCLHEP.cmake is never used? So the question is weather there is a bug in the geant cmake or how to properly setup cmake for my project so that using only include(${Geant4_USE_FILE}) I will get the same clhep as geant was build with? Cheers, Marko
Yes, looks like a bug in the way an external CLHEP is re-found. It should use the FindCLHEP module (for now, this is a temporary solution because of having to support older CLHEP versions) so I'll prepare a patch for that.
Created attachment 398 [details] Preliminary patch Attached is a preliminary patch to resolve this - it is provided here for your convenience, as it has not yet passed nightly testing, though continuous is good I have confirmed the bug locally, and the patch does resolve the issue for me. Please apply it an report any issues. I will mark as resolved once the patch has passed testing and barring any further problems.
Hi, thank you for looking into this. I have applied the patch and it works. When will this be officially released e.g. 10.2.2? Cheers, Marko
Apologies for the delay in updating - the tag is accepted, so will be in the next patch release. I do not have an exact date for this, but it is likely to be at the end of June when the 10.3 beta comes out.
So there will be no patch to 10.2 anymore?
(In reply to comment #5) > So there will be no patch to 10.2 anymore? To clarify - the next patch to 10.2, 10.2.2, is expected at the end of June. This coincides with the beta release of 10.3.