Skip to content

Including "CMakeLists.txt" in path passed to Config::new() causes full rebuilds every time #252

@Patrick-6

Description

@Patrick-6

I noticed that my cmake project was getting completely rebuilt on every tiny change.

The issue was that I used path/to/cmake/project/CMakeLists.txt instead of path/to/cmake/project/ when calling cmake::Config::new(path) in my build script. This caused this check to always return true (since the path from the CMakeCache.txt file doesn't include "CMakeLists.txt"), so the build directory was deleted before every compilation.

The simplest fix would be to either error out on or remove the string "CMakeLists.txt" for all paths passed into Config::new (here).
Alternatively, this check could be changed to ignore the "CMakeLists.txt" on either path.


Workaround:

Don't include "CMakeLists.txt" in the path for Config::new.


Tested with:

cmake-rs version 0.1.54
cmake    version 3.31.6
Linux, Debian 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions