pkg_check_modules with "::" in prefix
I have a CMakeLists.txt statement that works with cmake 2.8.12.2 and 3.7.2 but fails with 3.9.0:
pkg_check_modules ("glog::glog" REQUIRED libglog)
I get error "syntax error, unexpected cal_SYMBOL, expecting } (36)"
I'm not getting any backward compat warnings, so I wonder if it should work with 3.9.0?
My coworker says he is also seeing the error with 3.8.2.
I made a simple test for this:
cmake_minimum_required (VERSION 2.8.12) project (TEST) find_package(PkgConfig REQUIRED) pkg_check_modules ("glog::glog" REQUIRED libglog)
Here is some sample output for the 3 cmake versions noted above:
chuck@h0:/tmp/test/b % cat ../CMakeLists.txt cmake_minimum_required (VERSION 2.8.12) project (TEST) find_package(PkgConfig REQUIRED) pkg_check_modules ("glog::glog" REQUIRED libglog) chuck@h0:/tmp/test/b % chuck@h0:/tmp/test/b % cmake --version cmake version 3.9.0 CMake suite maintained and supported by Kitware (kitware.com/cmake). chuck@h0:/tmp/test/b % cmake .. -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- 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 -- Detecting C compile features -- Detecting C compile features - 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 -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") CMake Error at /tmp/cmake/share/cmake-3.9/Modules/FindPkgConfig.cmake:587 (if): Syntax error in cmake code at /tmp/cmake/share/cmake-3.9/Modules/FindPkgConfig.cmake:587 when parsing string ${__pkg_config_arguments_glog::glog} syntax error, unexpected cal_SYMBOL, expecting } (36) Call Stack (most recent call first): CMakeLists.txt:4 (pkg_check_modules) -- Configuring incomplete, errors occurred! See also "/tmp/test/b/CMakeFiles/CMakeOutput.log". chuck@h0:/tmp/test/b % rm -rf * chuck@h0:/tmp/test/b % chuck@h0:/tmp/test/b % /usr/bin/cmake --version cmake version 2.8.12.2 chuck@h0:/tmp/test/b % /usr/bin/cmake .. -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- 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 -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") -- checking for module 'libglog' -- found libglog, version 0.3.3 -- Configuring done -- Generating done -- Build files have been written to: /tmp/test/b chuck@h0:/tmp/test/b % chuck@h0:/tmp/test/b % rm -rf * chuck@h0:/tmp/test/b % chuck@h0:/tmp/test/b % /proj/TableFS/data/travis14/cache/bin/cmake --version cmake version 3.7.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). chuck@h0:/tmp/test/b % /proj/TableFS/data/travis14/cache/bin/cmake .. -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- 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 -- Detecting C compile features -- Detecting C compile features - 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 -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") -- Checking for module 'libglog' -- Found libglog, version 0.3.3 -- Configuring done -- Generating done -- Build files have been written to: /tmp/test/b chuck@h0:/tmp/test/b %