[CMake] Problems moving my project to 2.6.0

Brad King brad.king at kitware.com
Sat May 10 18:47:23 EDT 2008


Karl Wallner wrote:
> Cmake segfaults during make process when trying to build shared libraries:
[snip]
> /build/wepsDIS-0.9.2-BUILD.linux-g++-Debug-CMake26-uups/SDK/libDIS/debug_shared/CMakeFiles/DISd.dir/DependInfo.cmake 
> --color=

I was able to reproduce the crash with this code:

   add_library(foo SHARED foo.c)
   set_target_properties(foo PROPERTIES SOVERSION \"1\")

> I was wondering why the version/soversion of the shared library was 
> still quoted.

The SOVERSION property does not try to interpret the value given.  It is 
treated literally as a string to put in the soname of the library.  If you 
give quotes they are considered part of that string.  CMake 2.4 was just not 
as good at escaping special characters on build lines.  If you look in the 
build rules generated by 2.4 you will see that the quotes did appear but 
they were not escaped so the make shell removed them.  CMake 2.6 escapes the 
quotes and they end up in the target.

I've fixed the crash:

/cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v  <-- 
Source/cmLocalUnixMakefileGenerator3.cxx
new revision: 1.250; previous revision: 1.249

and fixed the logic so that quotes can actually be put in the soversion:

/cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v  <-- 
Source/cmLocalUnixMakefileGenerator3.cxx
new revision: 1.251; previous revision: 1.250
/cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v  <-- 
Source/cmMakefileTargetGenerator.cxx
new revision: 1.99; previous revision: 1.98

The fixes will be in 2.6.1.

Of course you don't really want the quotes, so you should fix your code to 
not put them in the SOVERSION property in the first place.

-Brad


More information about the CMake mailing list