CMake `cmake install` failed
Opened this issue · 4 comments
Description
When I install cpr library by IDE, it was wrong.
cmake install
output message:
[0/1] Install the project...
CMake Error at _deps/zlib-build/cmake_install.cmake:41 (file):
file cannot create directory: C:/Program Files (x86)/FLowD/lib. Maybe need
administrative privileges.
Call Stack (most recent call first):
_deps/cpr-build/cmake_install.cmake:42 (include)
src/cmake_install.cmake:62 (include)
cmake_install.cmake:42 (include)
-- Install configuration: "Debug"
FAILED: CMakeFiles/install.util
C:\WINDOWS\system32\cmd.exe /C "cd /D F:\Code\CppProjects\FlowD\cmake-build-debug && "D:\Program Files\JetBrains\CLion 2023.3.4\bin\cmake\win\x64\bin\cmake.exe" -P cmake_install.cmake"
ninja: build stopped: subcommand failed.
It seems to be installed by default on the C drive, but my CMakeLists.txt is:
if(WIN32) # Install dlls in the same directory as the executable on Windows
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src)
endif()
include(FetchContent)
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG aa581c9d8060b2502707ad96a04f4829cc524fcb)
FetchContent_MakeAvailable(cpr)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
cpr::cpr
)
Example/How to Reproduce
- CLion IDE
- Build - Install
Possible Fix
No response
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
- OS: Windows
- Version: latest
But without CLion it installs in the correct directory?
But without CLion it installs in the correct directory?
The command in bash is the same as in Clion.
Can confirm. There is something wrong. Especially in regards to zlib. When setting -DCMAKE_BUILD_TYPE=Release
it tries to install zlib from the Debug
directory and vise versa.
How critical is this bug to you?
Can confirm. There is something wrong. Especially in regards to zlib. When setting
-DCMAKE_BUILD_TYPE=Release
it tries to install zlib from theDebug
directory and vise versa. How critical is this bug to you?
It will prevent me from using cmake install
to install dependencies, which may later affect CI/CD automatic packaging into an executable file.