CMake with --warn-unused-vars warns about all unused CMAKE_* variables - cmake

I want to use the --warn-unused-vars flag with CMake, but it floods the output with warnings to unused CMAKE_* variables. It happens even with an empty CMakeLists.txt file, but to generate an example I used this one:
cmake_minimum_required(VERSION 3.15)
project(p)
set(myVar)
If I run cmake --warn-unused-vars .. it generates the following output:
Finding unused variables.
CMake Warning (dev) in build/CMakeFiles/3.15.4/CMakeSystem.cmake:
unused variable (changing definition) 'CMAKE_CURRENT_LIST_FILE'
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in build/CMakeFiles/3.15.4/CMakeSystem.cmake:
unused variable (changing definition) 'CMAKE_CURRENT_LIST_DIR'
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at build/CMakeFiles/3.15.4/CMakeSystem.cmake:1 (set):
unused variable (changing definition) 'CMAKE_HOST_SYSTEM'
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at build/CMakeFiles/3.15.4/CMakeSystem.cmake:2 (set):
unused variable (changing definition) 'CMAKE_HOST_SYSTEM_NAME'
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at build/CMakeFiles/3.15.4/CMakeSystem.cmake:3 (set):
unused variable (changing definition) 'CMAKE_HOST_SYSTEM_VERSION'
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
[This and similar stuff goes on for 6000+ lines]
I expected CMake to only warn about myVar (it does warn about it as well among all that noise). Do I have to filter the output by myself or is there some kind of additional flag I have to pass or configuration I have to change in order to limit the warnings to my CMake files? With -Wno-dev it also suppresses the warning about myVar which I want to keep.

Related

an error about liridar config concering Cmake

CMake Error at /opt/ros/melodic/share/pcl_ros/cmake/pcl_rosConfig.cmake:113 (message):
Project 'pcl_ros' specifies '/usr/include/eigen3' as an include dir, which
is not found. It does neither exist as an absolute directory nor in
'${{prefix}}//usr/include/eigen3'. Check the issue tracker
'https://github.com/ros-perception/perception_pcl/issues' and consider
creating a ticket if the problem has not been reported yet.
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
lslidar_c32/lslidar_c32_driver/CMakeLists.txt:22 (find_package)
find how to solve the error

Set -Wno-dev in CMakeLists.txt

I use the SDL2 CMake Modules and include them in my CMakeLists.txt like this
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
find_package(SDL2 REQUIRED)
find_package(SDL2_gfx REQUIRED)
There, they generate the warning
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.21.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to find_package_handle_standard_args (SDL2main)
does not match the name of the calling package (SDL2). This can lead to
problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
cmake/sdl2/FindSDL2.cmake:318 (FIND_PACKAGE_HANDLE_STANDARD_ARGS CMakeLists.txt:13 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
I don't care about that warning and want to suppress it.
However, I don't want to pass -Wno-dev to the cmake command itself, I would rather set that flag in the CMakeLists.txt.

cmake/config-ix.cmake:401 (get_host_triple) error when trying to build LLVM with CMake on Windows

I want to set up a debugger for Visual Studio Code so I tried to build LLVM environment so as to have LLDB on my computer. But the build fails with following output:
CMake Warning at cmake/modules/GetHostTriple.cmake:28 (message):
unable to determine host target triple
Call Stack (most recent call first):
cmake/config-ix.cmake:401 (get_host_triple)
CMakeLists.txt:670 (include)
CMake Error at cmake/config-ix.cmake:409 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
Call Stack (most recent call first):
CMakeLists.txt:670 (include)
CMake Error at cmake/config-ix.cmake:453 (message):
Unknown architecture host
Call Stack (most recent call first):
CMakeLists.txt:670 (include)
I use clang v11.0.1, CMake v3.18.0-rc4, and Ninja v1.10.2.
I had same problem and fixed by adding this line manually as build option:
-DLLVM_HOST_TRIPLE=x86_64

CMake generates error with project statement in CLion

I'm trying to load a project into CLion (using Windows 10 and Cygwin). When CLion processes the CMakeLists.txt file, the following errors are generated
C:\Users\doobop\.CLion2017.2\system\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /cygdrive/m/stream
CMake Error at /cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/CMakeDetermineSystem.cmake:180 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:12 (project)
-- The C compiler identification is GNU 5.4.0
CMake Error at /cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/CMakeDetermineCCompiler.cmake:175 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:12 (project)
-- The CXX compiler identification is GNU 5.4.0
CMake Error at /cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/CMakeDetermineCXXCompiler.cmake:170 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:12 (project)
CMake Error at /cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/CMakeDetermineRCCompiler.cmake:55 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/Platform/CYGWIN-GNU.cmake:50 (enable_language)
/cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/Platform/CYGWIN-GNU-C.cmake:2 (__cygwin_compiler_gnu)
/cygdrive/c/Users/doobop/.CLion2017.2/system/cygwin_cmake/share/cmake-3.8.2/Modules/CMakeCInformation.cmake:48 (include)
CMakeLists.txt:12 (project)
What is at line 12?
project( SWP )
Why would the project assignment cause all these errors?

cmake parse error :Invalid escape sequence \o

I have a lot of similar error alert info like this type:
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts
Invalid escape sequence \o
The file C:/yumen/wxgisgdal-read-only/cmake/common.cmake is
like is:
#add data
macro(add_files_macro FPATH FGROUP)
file(GLOB GDAL_AHHEADERS ${FPATH}/*.h ${FPATH}/*.hpp)
set(GDAL_HHEADERS ${GDAL_HHEADERS} ${GDAL_AHHEADERS})
source_group("Header Files\\${FGROUP}" FILES ${GDAL_AHHEADERS})
file(GLOB GDAL_ACSOURCES ${FPATH}/*.cpp ${FPATH}/*.cc ${FPATH}/*.c)
set(GDAL_CSOURCES ${GDAL_CSOURCES} ${GDAL_ACSOURCES})
source_group("Source Files\\${FGROUP}" FILES ${GDAL_ACSOURCES})
endmacro()
Below is the CMake error info:
gdal version=[1.9.0]
GDAL lib name ... wxgisgdal19
c++ compiler ... cl
CMake Error at CMakeLists.txt:92 (option):
option called with incorrect number of arguments: BUILD_RELEASE_DEBUG_DIRS
Set OFF to build each co# uninstall target
configure_file(
C:/yumen/wxgisgdal-read-only/cmake_uninstall.cmake.in
C:/yumen/wxgisgdal-read-only/build/cmake_uninstall.cmake
IMMEDIATE #ONLY)nfiguration to a separate directory ON
Found GEOS: C:/geos-3.2.3/lib/geosd.lib
Found Proj: C:/PROJ/lib/proj.lib
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:121 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:121 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\generic
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:122 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\generic
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:122 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\mem
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:125 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\mem
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:125 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\vrt
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:130 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\vrt
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:130 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\csv
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:135 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\csv
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:135 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\dxf
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:140 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\dxf
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:140 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\shp
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:145 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\shp
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:145 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
Found PostgreSQL: C:/pgsql/lib
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\pg
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:158 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\pg
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:158 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\gml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:163 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\gml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:163 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\mitab
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:168 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\mitab
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:168 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
Found LIBKML: C:\Users\Public\libkml-read-only\msvc\Debug
Found LIBKML Headers: C:/Users/Public/libkml-read-only/src
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\libkml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:184 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\libkml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:184 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\kml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:187 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\kml
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:187 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\geojson
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:193 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\geojson
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:193 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:5 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5
when parsing string
Header Files\\ogr\ogrsf_frmts\geojson\jsonc
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:195 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/common.cmake:8 (source_group):
Syntax error in cmake code at
C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8
when parsing string
Source Files\\ogr\ogrsf_frmts\geojson\jsonc
Invalid escape sequence \o
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/ogr.cmake:195 (add_files_macro)
CMakeLists.txt:135 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
Found JPEG: C:/GnuWin32/lib/jpeg.lib
Configuring incomplete, errors occurred!
A guy told me that I should add something like this:
In Header Files\\ogr\ogrsf_frmts need to add terminator '\' like this:
"Header Files\\ogr\\ogrsf_frmts"
but as I paste the common.cmake file content line 5:
source_group("Header Files\\${FGROUP}" FILES ${GDAL_AHHEADERS})
the string after Header Files is replaced by FGROUP macro, may generated automatically by CMake, so I can not edit them.
The error is happening because the contents of the variable ${FGROUP} contain paths with Windows-style separators. These are treated by CMake as escape characters.
You should change your macro to a function to avoid this. From the docs for macro:
Note that the parameters to a macro and values such as ARGN are not variables in the usual CMake sense. They are string replacements much like the c preprocessor would do with a macro. If you want true CMake variables you should look at the function command.