Skip to content

Change the root dir of ixwebsocket-config.cmake to CMAKE_CURRENT_BINARY_DIR #452

@Numendacil

Description

@Numendacil

Currently, the CMakeLists.txt of this project uses CMAKE_BINARY_DIR as the root directory for the configuration file, which causes ixwebsocket-config.cmake to be added in the root dir of build tree (defaults to ./build or ./out/build/xxx/ for Visual Studio on Windows), even if it is included as a submodule with add_subdirectory.

Since we are not actually using this file in the build tree (only to be copied when cmake install is called), I believe that it is better if we use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR so that the file is placed in a separate subdirectory under ./build when used as a subproject, since on some build systems the call to find_package(ixwebsocket QUIET) will search in the root of ./build and, upon finding ixwebsocket-config.cmake, wrongly took it to be the installed config file and raise an error since it is unable to find ixwebsocket-targets.cmake. The use of CMAKE_CURRENT_BINARY_DIR is the default behavior for configure_file if a relative path is given for the output file.

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