[CMake] Cmake 3.1.1 generates CodeBlocks project file with full paths instead of relative ... bug ?

Jiri Hoogland jiri.hoogland at gmail.com
Mon Feb 2 23:34:16 EST 2015


Hi

I have a project for which I would like to generate a CodeBlocks,
There are a bunch of libraries I build under project_root/src/lib{1,2,3}

The CMakeLists.txt file in the lib{1,2,3} directories use the following
function
to set up the relevant bits

function( add_cxx_library lib_name )

set( dependencies ${ARGN} )
project( ${lib_name} )
file( GLOB_RECURSE lib_sources "*.cpp" )
file( GLOB_RECURSE lib_headers "*.h" )
add_library( ${lib_name} SHARED ${lib_sources} ${lib_headers} )

install( DIRECTORY ${PROJECT_SOURCE_DIR}
         DESTINATION include/{lib_name}
         FILES_MATCHING PATTERN "*.h" )

endfunction()

I added the header files because appearantly that makes the headers show up
in the IDE...

When running (OSX Maverick, CMake 3.1.1)

cmake -G "CodeBlocks - Unix Makefiles"

from project_root/build the cbp file is generated, and on opening in
CodeBlocks
the files in the project show up under an absolute path from / instead of
relative to project_root/src

/Users/Jiri/dev/cpp/project/src/Lib1/file{1,2,3}.{h,cpp}

instead of

Lib1/file{1,2,3}.{h,cpp}

Switching to

file( GLOB_RECURSE lib_sources RELATIVE ${PROJECT_SOURCE_DIR} "*.cpp" )
file( GLOB_RECURSE lib_headers RELATIVE ${PROJECT_SOURCE_DIR} "*.h" )

doesnt help...

If I would generate the cbp file directly in CodeBlocks it would do exactly
what I want.

Could it be there is some bug in cmake ?
Googling around there is some mention of this type of behaviour in CMake
2.8.4,
which was fixed in 2.8.6... http://www.cmake.org/Bug/view.php?id=12110

I am a bit at loss what is going on here..
Is the bug still there ?
There is no documentation found anywhere

Could someone shed some light, and possible a solution ?
Many thanks

Jiri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150202/3a16b024/attachment.html>


More information about the CMake mailing list