Skip to content

cmake SOURCE_DIR issues noted when using as a submodule #329

@tom-seddon

Description

@tom-seddon

I'm using PDCursesMod as a submodule of my project, building it from source as part of the build process and linking with the built copy. (This is my own workaround for the lack of a standard package manager on Windows or macOS...)

I encountered some issues attempting this with PDCursesMod on Windows with cmake. There's a couple of places where CMAKE_SOURCE_DIR (folder specified on the command line, containing the root CMakeLists.txt specified) is used, that should be CMAKE_CURRENT_SOURCE_DIR (folder specified with add_subdirectory, containing some subproject).

And, similarly, a couple of places where I had to replace CMAKE_SOURCE_DIR with CMAKE_CURRENT_LIST_DIR (folder containing current cmake code included using include).

Symptoms of these were the build process trying to find pdcurses stuff from the root folder of my own project.

Diffs here: tom-seddon@838d11c - but this only fixes my immediate issue, and some of the other CMAKE_SOURCE_DIR uses might need fixing up if doing this properly. So no PR, just an issue. But I thought it could be worth noting.

Thanks,

--Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions