[CMake] Object files list in project after 3.7 upgrade

mapron mapron at yandex.ru
Fri Jun 2 23:30:42 EDT 2017


Hello,

I have noticed after upgrading to Cmake 3.7 (3.8.2 problem still 
exists): when using object libraries, generated object files now persist 
in project tree (just after configuration).

You can see Qt Creator screenshot at 
https://bugreports.qt.io/browse/QTCREATORBUG-18308

Actually, when using generator CodeBlocks + Ninja, .cbp files are 
different, e.g:

         <Unit filename="/home/mapron/bugs/lib.cpp">
             <Option target="demoLib_"/>
         </Unit>
         <Unit filename="/home/mapron/bugs/test.cpp">
             <Option target="demo"/>
         </Unit>
         <Unit filename="/home/mapron/bugs/CMakeLists.txt">
             <Option virtualFolder="CMake Files\"/>
         </Unit>

for 3.6, and


         <Unit filename="/home/mapron/bugs/lib.cpp">
             <Option target="demoLib_"/>
         </Unit>
         <Unit filename="/home/mapron/bugs/test.cpp">
             <Option target="demo"/>
         </Unit>
         <Unit 
filename="/home/mapron/build-bugs-cmake382-Default/CMakeFiles/demoLib_.dir/lib.cpp.o">
             <Option target="demoLib"/>
         </Unit>
         <Unit filename="/home/mapron/bugs/CMakeLists.txt">
             <Option virtualFolder="CMake Files\"/>

for 3.8.2

cmake file have these contents:

cmake_minimum_required(VERSION 3.5.0)
project(demo)
set(libSources lib.cpp)
add_library(demoLib_ OBJECT ${libSources})
set(libSources $<TARGET_OBJECTS:demoLib_>)

#set_source_files_properties(${libSources} PROPERTIES EXTERNAL_OBJECT 
true GENERATED true)
add_library(demoLib STATIC ${libSources})
add_executable(demo test.cpp)

Any ideas? Is this bug or feature?



More information about the CMake mailing list