Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake cmake install failed #1103

Open
L-Super opened this issue Aug 28, 2024 · 4 comments
Open

CMake cmake install failed #1103

L-Super opened this issue Aug 28, 2024 · 4 comments

Comments

@L-Super
Copy link
Contributor

L-Super commented Aug 28, 2024

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

)

The same as https://github.com/libcpr/example-cmake-fetch-content/blob/a733fb21fda0f17051fa319c4075649823f04226/CMakeLists.txt#L25-L28

Example/How to Reproduce

  1. CLion IDE
  2. 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
@COM8
Copy link
Member

COM8 commented Aug 28, 2024

But without CLion it installs in the correct directory?

@L-Super
Copy link
Contributor Author

L-Super commented Aug 28, 2024

But without CLion it installs in the correct directory?

The command in bash is the same as in Clion.

@COM8
Copy link
Member

COM8 commented Sep 22, 2024

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?

@L-Super
Copy link
Contributor Author

L-Super commented Sep 27, 2024

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?

It will prevent me from using cmake install to install dependencies, which may later affect CI/CD automatic packaging into an executable file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants