win10+ vs2017用cmake编译geos3.5.1

参考教程:使用CMake编译Geos3.5.0_cmake geos-CSDN博客


注意事项:

报错:在使用cmake编译geos-3.5.1的时候,会出现报错:

CMake Error at CMakeLists.txt:330 (include):

        include could not find load file

                GenerateSourceGroups

CMake Error at include/CMakeLists.txt:57 (GenerateSourceGroups):

        Unknown CMake command "GenerateSourceGroups"

解决方法:

把以下内容保存到GenerateSourceGroups.cmake中

#
# Macro generates tree of IDE source groups based on folders structure
# Source: http://www.cmake.org/pipermail/cmake/2013-November/056332.html
# 
macro(GenerateSourceGroups curdir)
  file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
  foreach(child ${children})
    if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
      GenerateSourceGroups(${curdir}/${child})
    else()
      string(REPLACE "/" "\\" groupname ${curdir})
      # I would like to call the src root folder in a different name, only in visual studio (not mandatory requirement)
	  string(REPLACE "src" "Source Files" groupname ${groupname})
      source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
    endif()
  endforeach()
endmacro()

并且把这个文件放到cmake/modules下面
win10+ vs2017用cmake编译geos3.5.1_第1张图片

你可能感兴趣的:(win10)