[CMake] CMAKE_EXPORT_COMPILE_COMMANDS don't work in CMakeLists.txt

Fabrício Ceolin fabricio.ceolin at miningmath.com
Wed Dec 7 11:16:44 EST 2016


Putting

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

right above defining target solve the problem.


Fabrício Ceolin
+55 (31) 98675-1359
MiningMath Associates
www.miningmath.com


2016-12-07 8:48 GMT-02:00 Wagner, David <david.wagner at intel.com>:

> I've tested this on Ubuntu 15.10 using CMake 3.2.2
>
> Where, in the CMakeLists did you put it? As far as I can tell, it needs to
> be done before defining the targets for which you want compile commands to
> be exported.
>
> W
>
> On 07/12/2016 11:35, Fabrício Ceolin wrote:
>
>> Hi,
>>
>> Thank you David. Which version of cmake and operational system are you
>> using?
>> In my CMakeLists.txt file, I tried to set
>>
>> set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
>>
>> and
>>
>> set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
>>
>> without success, unfortunately.
>>
>> Em qua, 7 de dez de 2016 às 08:13, Wagner, David <david.wagner at intel.com
>> <mailto:david.wagner at intel.com>> escreveu:
>>
>>
>>
>>
>>     On 05/12/2016 12:31, Fabrício Ceolin wrote:
>>      > Hi,
>>      >
>>      > I am trying to put
>>      > set(CMAKE_EXPORT_COMPILE_COMMANDS ,1) inside a toolchain file but
>> the command
>>      > has no effect there. I've tried to put it in CMakeLists.txt too
>> using the
>>      > previosly set and add_definitions(-DCMAKE_EXPORT_COMPILE_COMMANDS=1)
>> without
>>      > success.
>>
>>     "set(CMAKE_EXPORT_COMPILE_COMMANDS 1)" inside the CMakeLists.txt
>> works for me
>>     but note that you have an extra comma before the "1" value. CMake
>> only uses
>>     commas for lists. It probably also works in the toolchain file. I
>> don't see how
>>     using add_definitions() would work because it is only used in the
>> compiler's
>>     command line.
>>
>>     W
>>
>>     --
>>     David Wagner
>>
>>     complex != complicated
>>     ---------------------------------------------------------------------
>>     Intel Corporation SAS (French simplified joint stock company)
>>     Registered headquarters: "Les Montalets"- 2, rue de Paris,
>>     92196 Meudon Cedex, France
>>     Registration Number:  302 456 199 R.C.S. NANTERRE
>>     Capital: 4,572,000 Euros
>>
>>     This e-mail and any attachments may contain confidential material for
>>     the sole use of the intended recipient(s). Any review or distribution
>>     by others is strictly prohibited. If you are not the intended
>>     recipient, please contact the sender and delete all copies.
>>
>>     --
>>
>>     Powered by www.kitware.com <http://www.kitware.com>
>>
>>     Please keep messages on-topic and check the CMake FAQ at:
>>     http://www.cmake.org/Wiki/CMake_FAQ <http://www.cmake.org/Wiki/CMa
>> ke_FAQ>
>>
>>     Kitware offers various services to support the CMake community. For
>> more
>>     information on each offering, please visit:
>>
>>     CMake Support: http://cmake.org/cmake/help/support.html
>>     <http://cmake.org/cmake/help/support.html>
>>     CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>     <http://cmake.org/cmake/help/consulting.html>
>>     CMake Training Courses: http://cmake.org/cmake/help/training.html
>>     <http://cmake.org/cmake/help/training.html>
>>
>>     Visit other Kitware open-source projects at
>>     http://www.kitware.com/opensource/opensource.html
>>     <http://www.kitware.com/opensource/opensource.html>
>>
>>     Follow this link to subscribe/unsubscribe:
>>     http://public.kitware.com/mailman/listinfo/cmake
>>     <http://public.kitware.com/mailman/listinfo/cmake>
>>
>>
> --
> David Wagner
>
> complex != complicated
> ---------------------------------------------------------------------
> Intel Corporation SAS (French simplified joint stock company)
> Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon
> Cedex, France
> Registration Number:  302 456 199 R.C.S. NANTERRE
> Capital: 4,572,000 Euros
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161207/8f294ace/attachment.html>


More information about the CMake mailing list