I am porting my application from linux to windows and I am running into this error for some hours now and I can not understand why it happens. I have this code that builds a git submodule that provides a makefile to build it.
# Configure variables for building mupdf
elseif(WIN32)
set(MUPDF_OUTPUT "${PROJECT_SOURCE_DIR}/libs/mupdf/platform/win32/x64/Release/mupdfcpp64.lib" PARENT_SCOPE)
set(MUPDF_OUTPUT "${PROJECT_SOURCE_DIR}/libs/mupdf/platform/win32/x64/Release/mupdfcpp64.lib")
set(MUPDF_BUILD_COMMAND "python scripts/mupdfwrap.py --venv -b -j 0 m01")
endif()
add_custom_command(
OUTPUT ${MUPDF_OUTPUT}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/mupdf
COMMAND ${MUPDF_BUILD_COMMAND}
COMMENT "Building mupdf (This takes a while) ..."
BYPRODUCTS ${MUPDF_OUTPUT}
)
add_custom_target(mupdf ALL
DEPENDS ${MUPDF_OUTPUT}
)
# Build
add_library(application
SHARED
${application_SRC}
)
# Make sure to build mupdf before the application
add_dependencies(application mupdf)
For some reason, I get the following output though, when trying to build the project:
-- Configuring done (0.7s)
-- Generating done (0.5s)
-- Build files have been written to: C:/Users/prtnp/Librum/build
Change Dir: 'C:/Users/prtnp/Librum/build'
Run Build Command(s): "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:n
Microsoft (R) Build Engine, version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
The build started on 07/22/2023 at 16:08:38.
Project "C:\Users\prtnp\Librum\build\ALL_BUILD.vcxproj" on node "1" (default targets).
The project "C:\Users\prtnp\Librum\build\ALL_BUILD.vcxproj" (1) is building "C:\Users\prtnp\Librum\build\ZERO_CHECK.vcxproj" (2) on node "1" (default targets).
InitializeBuildStatus:
Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
All outputs are up-to-date.
1>Checking Build System
FinalizeBuildStatus:
Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
The project "C:\Users\prtnp\Librum\build\ZERO_CHECK.vcxproj" is complete (default targets).
The project "C:\Users\prtnp\Librum\build\ALL_BUILD.vcxproj" (1) is building "C:\Users\prtnp\Librum\build\src\application\mupdf.vcxproj" (3) on node "1" (default targets).
InitializeBuildStatus:
Touching "x64\Debug\mupdf\mupdf.tlog\unsuccessfulbuild".
CustomBuild:
"Building mupdf (This takes a while) ..."
The system cannot find the path specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019/Community/MSBuild/Microsoft/VC/v160/Microsoft.CppCommon.targets(241,5): error MSB8066: The custom build for "C:\Users\prtnp\Librum\build\CMakeFiles\8e03d71809f012c9d6e5459fc00784b2\mupdfcpp64.lib.rule;C:\Users\prtnp\Librum\build\CMakeFiles\5736ecdae8f9a33915df7c26a6ac3c00\mupdf.rule" exited with code 3. [C:\Users\prtnp\Librum\build\src\application\mupdf.vcxproj]
The project "C:\Users\prtnp\Librum\build\src\application\mupdf.vcxproj" is complete (default targets) -- ERROR.
The project "C:\Users\prtnp\Librum\build\ALL_BUILD.vcxproj" is complete (default targets) -- ERROR.
Build failed.
"C:\Users\prtnp\Librum\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\prtnp\Librum\build\src\application\mupdf.vcxproj" (default target) (3) ->
(CustomBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019/Community/MSBuild/Microsoft/VC/v160/Microsoft.CppCommon.targets(241,5): error MSB8066: The custom build for "C:\Users\prtnp\Librum\build\CMakeFiles\8e03d71809f012c9d6e5459fc00784b2\mupdfcpp64.lib.rule;C:\Users\prtnp\Librum\build\CMakeFiles\5736ecdae8f9a33915df7c26a6ac3c00\mupdf.rule" exited with code 3. [C:\Users\prtnp\Librum\build\src\application\mupdf.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.28
Does someone have an idea why this is happening? I can't seem to figure it out.
Running the ${MUPDF_BUILD_COMMAND}
manually in the WORKING_DIRECTORY
works just fine. I invoke the cmake script via cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=C:\\Qt\\6.5.2\\msvc2019_64 ..