#565

Add ability to disable installation via `ZYDIS_INSTALL`

OpenStackOverflowExcept1onopened 1y ago

https://github.com/StackOverflowExcept1on/funchook/blob/908b05224361a5ad0fe346c8277adb3ddb232205/CMakeLists.txt#L129-L147

I'm using Zydis v4.1.1 and trying to build my project like this:

cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ...
cmake --build . --config Release --target INSTALL

However, this results in "Maybe need administrative privileges" error:

PostBuildEvent:
  setlocal
  "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  :cmErrorLevel
  exit /b %1
  :cmDone
  if %errorlevel% neq 0 goto :VCEnd
  :VCEnd
  -- Install configuration: "Release"
  CMake Error at _deps/zydis-build/cmake_install.cmake:36 (file):
    file cannot create directory: C:/Program Files
    (x86)/library/lib/cmake/zydis.  Maybe need administrative privileges.
  Call Stack (most recent call first):
    _deps/funchook-build/cmake_install.cmake:37 (include)
    cmake_install.cmake:37 (include)

I am also using latest version of cmake (4.0.0):

CMake Deprecation Warning at build/_deps/zydis-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


CMake Deprecation Warning at build/_deps/zydis-src/dependencies/zycore/CMakeLists.txt:5 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

Activity

4
athre0z1y ago

Hm. You're explicitly requesting an installation with --target INSTALL, no? Can you not just.. not do that?

StackOverflowExcept1on1y ago

@athre0z I have my own targets to install. Workaround might be as follows: -DCMAKE_INSTALL_PREFIX=.

athre0z1y ago

So you were running cmake --build . --config Release --target INSTALL on your own software that depends on Zydis, and that also invokes the Zydis install target? I was under the impression that CMake doesn't do such propagation. I had to add extra plumbing in some project to also install Zycore. Perhaps I'm missing something, or it varies depending on platform?

StackOverflowExcept1on1y ago

@athre0z funchook uses Zydis and then I add it to my project since it's already available.