[CMake] Using try_compile before project() command

Yuri Timenkov ytimenkov at parallels.com
Wed Jul 16 08:30:37 EDT 2008


On Wednesday 16 July 2008 16:20:30 Bill Hoffman wrote:
> Carminati Federico wrote:
> > Hello,
> >    my use case is similar. My package depends on another one that can be
> > installed with different compiler choices. So the first action I take is
> > always to check the compiler used to install the other package and then
> > to use the same. I could obviously do
> >
> > export CXX=`root-config --cxx` ; export CC=`root-config -cc` ;  cmake .
> >
> > but I would really prefer to do everything inside the CMakeLists.txt.
> > This is easy to do with the Fortran compiler, as I enable Fortran after
> > having chosen the compiler. For the moment i set also the c and cxx
> > compilers and it works, but this is explicitly "deprecated" by the CMake
> > doc. BEst,
>
> You might want to wrap cmake into a script of some sort for that machine.
Or you can compare ${CMAKE_C_COMPILER} with "root-config --cc" output after 
determined correct library paths to ensure right choice.

>
> -Bill



More information about the CMake mailing list