Skip to content

Use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR #42

@Riften

Description

@Riften

At line 46 in top level CMakeLists.txt file, CMAKE_SOURCE_DIR is used as the source path when installing include directory.

install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "include/${PROJECT_NAME}")

However, this may cause error if this package is used as a submodule of another CMake project, such as

- Other Prj
  - TOP CMakeLists.txt
  - PSOPT
    - CMakeLists.txt for PSOPT

In that case, CMAKE_SOURCE_DIR would be <Other Prj> instead of <Other Prj>/PSOPT.

Use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR could be one way to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions