[CMake] cmake-2.8.12: generator expression error when linker flags have comma

Jed Brown jed at 59A2.org
Sat Oct 19 19:01:55 EDT 2013


I just upgraded from cmake-2.8.11.2 to 2.8.12 and now get errors when a
comma ',' appears in a linker flag.  Test case below.  Note that this is
but one of many reasons for a comma to appear in linker flags.

https://gist.github.com/jedbrown/7062540

    $ mkdir build && cd build
    $ cmake -DDEP_LIBS:STRING='-Wl,--start-group -llapack -lblas -Wl,--end-group' ..
    -- The C compiler identification is GNU 4.8.2
    -- The CXX compiler identification is GNU 4.8.2
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Configuring done
    CMake Error:
      Error evaluating generator expression:
    
        $<LINK_ONLY:-Wl,--start-group -llapack -lblas -Wl,--end-group>
    
      $<LINK_ONLY> expression requires exactly one parameter.
    
    CMake Warning (dev) in CMakeLists.txt:
      Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
      interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    
      Static library target "foo" has a INTERFACE_LINK_LIBRARIES property.  This
      should be preferred as the source of the link interface for this library.
      Ignoring the property and using the link implementation as the link
      interface instead.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Generating done
    -- Build files have been written to: /tmp/cmake-comma/build


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131019/b14540d4/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.cc
Type: text/x-c++src
Size: 22 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131019/b14540d4/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar.cc
Type: text/x-c++src
Size: 22 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131019/b14540d4/attachment-0001.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131019/b14540d4/attachment.pgp>


More information about the CMake mailing list