Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,307
    • Issues 3,307
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21738

Closed
Open
Created Jan 23, 2021 by Nobun@AncientLich

ExternalProject: CMAKE_CACHE_ARGS adds an unwanted semicolon to PATH variables if quoted

Bug happend with cmake 3.16.3 on Ubuntu 20.04

when using parameter CMAKE_CACHE_ARGS on ExternalProject_Add:

ExternalProject_Add(project_name
                    URL "...."
                    URL_MD5 "..."
                    ...
                    CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_BINARY_DIR}/install/path"
)

if you use quotes like the provided example, than an unwanted semicolon is created to the install path by ExternalProject

that case the resulting path will be "install/path;/..." instead of "install/path/..." similary, if you set a final slash than an extra subdirectory ; will be created so

 CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_BINARY_DIR}/install/path/"

will installs external project in "install/path/;/..." instead of "install/path"

Avoiding, instead, using quotes will work correctly so

CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/install/path

will correctly install external project in "install/path" as desired.

this is the real code causing the issue when CMAKE_CACHE_ARGS is quoted as previously described (posting the working, non-quoted, code):

ExternalProject_Add(project_lua
                    URL "http://www.lua.org/ftp/lua-5.3.6.tar.gz"
                    URL_MD5 "83f23dbd5230140a3770d5f54076948d"
                    DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/download
                    SOURCE_DIR ${CMAKE_BINARY_DIR}/lib/src/lua53
                    CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/lib/install/lua
)

ExternalProject_Add_Step(project_lua clone_cmakelists
                         DEPENDEES mkdir download
                         DEPENDERS configure
                         COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/lib/mods/lua/CMakeLists.txt" "${CMAKE_BINARY_DIR}/lib/src/lua53"
)
Edited Jan 23, 2021 by Craig Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None