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,194
    • Issues 3,194
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 16
    • Merge Requests 16
  • 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
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • CMake
  • CMakeCMake
  • Issues
  • #18321

Closed
Open
Opened Sep 03, 2018 by Alessandro Pezzato@alepezContributor

gtest_add_tests fails if any source is empty

include(GoogleTest)

file(GLOB_RECURSE myprojectest_SRC
  "${PROJECT_SOURCE_DIR}/src/*_test.cpp"
)
add_executable(myprojecttest ${myprojecttest_SRC})
gtest_add_tests(TARGET myprojectest)

Add some files with tests in src directory: works fine.

Add an empty file. Now cmake failes with obscure errors:

CMake Error at /usr/share/cmake-3.12/Modules/GoogleTest.cmake:311 (string):
  string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  CMakeLists.txt:125 (gtest_add_tests)

If a source file is empty or doesn't have any test, it shouldn't fail.

Sometimes I (and I guess other developers) add some "placeholder" empty file where future tests have to be created.

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
Reference: cmake/cmake#18321