添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

FetchContent fails to set the projectName_SOURCE_DIR if the projectName is not in only lower-case letters

This project has only one file: CMakeLists.txt file

include(FetchContent)
message(STATUS "getting plexil_SOURCE_DIR")
FetchContent_Declare(
  plexilE
  URL https://github.com/plexil-group/plexil/archive/refs/tags/release/plexil-4.6-alpha.zip
  # GIT_REPOSITORY https://github.com/plexil-group/plexil.git
  # GIT_TAG        df7bd4f98e7c0ef12426b48be90e440fe4823802 # plexil 4.6 alpha
message(STATUS "plexilE_SOURCE_DIR = ${plexilE_SOURCE_DIR}")
FetchContent_MakeAvailable(plexilE)
message(STATUS "plexilE_SOURCE_DIR: ${plexilE_SOURCE_DIR}")

Configuring it with cmake . we get:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as
    project(ProjectName)
  near the top of the file, but after cmake_minimum_required().
  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- 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
-- getting plexil_SOURCE_DIR
-- plexilE_SOURCE_DIR = 
-- plexilE_SOURCE_DIR: 
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as
    cmake_minimum_required(VERSION 3.16)
  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bhashem1/Repos/CMakeIssue2

If you name the project plexile instead of plexilE the path will be set after MakeAvailable command. This issue occurs on both Ubuntu (20.04) and Apple OS.