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.
Currently, the CMakeLists.txt of this project uses
CMAKE_BINARY_DIRas the root directory for the configuration file, which causes ixwebsocket-config.cmake to be added in the root dir of build tree (defaults to./buildor./out/build/xxx/for Visual Studio on Windows), even if it is included as a submodule withadd_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_DIRinstead ofCMAKE_BINARY_DIRso that the file is placed in a separate subdirectory under ./build when used as a subproject, since on some build systems the call tofind_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 ofCMAKE_CURRENT_BINARY_DIRis the default behavior forconfigure_fileif a relative path is given for the output file.