2013/1/7 Willy Lambert <lambert.wi...@gmail.com>: > 2013/1/4 Gregor Jasny <gja...@googlemail.com>: >> Hello Willy, >> >> On 1/4/13 4:58 PM, Willy Lambert wrote: >>> I am trying to convert an existing project from Manual Makefiles to >>> Cmake for building it. >>> We have a logger that rely on the __FILE__ define to say which file is >>> "writing" into the log but this is broken by the CMake default >>> behavior using absolute paths. >>> So I wonder if there is any way to have the file name in the code to >>> be able to log "Error : line XXX in file.cpp". >> >> This is somewhat hackish and should be surrounded by a check for the >> Makefile generator: >> >> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst >> ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") >> >> Thanks, >> Gregor >> > > Thanks ! This is working and is a great solution for us. CMake is in > love with abspath anyway, so whatever I'll do, it'll be hackish. > > I wasn't aware that CMake was letting us hacking with make likewise. I > agree it is not a clean way but when it is the only solution it is a > good exit gate when converting project from makefiles. Is this > features expected by CMake or is it a un-wanted bug ? May I rely on > Cmake kepping this behavior in futur versions. >
ehhhhh, in fact it works only for the cpp file. But included files are not stated correctly (case of inlined functions)... But it's a step. >> -- >> >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake