[CMake] problem with change of compiler

Sowa, Bartlomiej (NSN - PL/Wroclaw) bartlomiej.sowa at nsn.com
Mon Dec 15 08:49:27 EST 2008


Hello,
 
I have a project, that actually consists of several modules that have
dependencies between them.
I want to add CTC (code coverage analysis) support, and in order to do
this I would need, similar than
with purify, to change compiler binary, but I need this to be done just
for directly dependant directories.
 
I link the modules by add_subdirectory and target_link_libraries.
 
I tried to do this in following way:
 
OPTION(USE_CTC "enable CTC for project (set also CTC_PROJECTS in
CMakeLists.txt)" NO)
...
 
    IF(USE_CTC AND NOT CTC_PROJECTS)
      message("WARNING: CTC_PROJECTS not set, will default to
'${SUBDIRS}'")
      SET(CTC_PROJECTS ${SUBDIRS})
    ENDIF(USE_CTC AND NOT CTC_PROJECTS)

...
 
      IF(USE_CTC AND CTC_PROJECTS)
 
        LIST(FIND CTC_PROJECTS ${PROJECT_NAME} DO_CTC)
        IF(DO_CTC EQUAL -1)
          SET(DO_CTC "FALSE")
        ELSE(DO_CTC EQUAL -1)
          SET(DO_CTC "TRUE")
        ENDIF(DO_CTC EQUAL -1)
 
        IF(DO_CTC)
          message("activate CTC")
          SET(CMAKE_CXX_COMPILER
"/opt/ctc++/linux/ix86/ctc++_6.3/bin/ctc")
          SET(CMAKE_CXX_COMPILER_ARG1 "-v -V -i fd -c /etc/ctc.ini
/some_path/i586-linux-gnu-i686-glibc_std-g++")
        ENDIF(DO_CTC)
 
      ENDIF(USE_CTC AND CTC_PROJECTS)

I could not do this via changing only CMAKE_CXX_COMPILER (can not find
compiler) but had to do this via ARG1 variable. Anyway, for some
projects it works as expected,
but for some others I get folowing error:
 
ERROR:
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /some_path/i586-linux-gnu-i686-glibc_std-g++

The bigger problem is, that it calls cmake again, but without any
commandline parameters, thus cannot find the toolchain, and fails at the
end.
So far I could not find why it works for some projects, and for some
others don't.
 
I hope you can help me on this one. I'm using cmake v2.6.2
 
Best Regards,
Bartek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081215/b24fad5d/attachment.htm>


More information about the CMake mailing list