projectM-visualizer / frontend-sdl2

Standalone application based on SDL2 that turns your desktop audio into awesome visuals. Available on most platforms supported by both libprojectM and libSDL2.
GNU General Public License v3.0
58 stars 32 forks source link

Building on Windows fails, cmake cannot find PCRE #26

Closed benj02 closed 2 years ago

benj02 commented 2 years ago

I have build libprojectM and am now trying to build this project, but I'm running into this error:

C:\home\SoundBetter\frontend-sdl2\build>cmake -G "Visual Studio 16 2019" -A "X64" -DCMAKE_TOOLCHAIN_FILE="C:\home\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_PREFIX_PATH="C:\home\SoundBetter\projectm\build\src\libprojectM\libprojectM" -CMAKE_INCLUDE_PATH="C:\home\vcpkg\buildtrees\pcre\x64-windows-rel" -CMAKE_LIBRARY_PATH="C:\home\vcpkg\installed\x64-windows\lib" ..
loading initial cache file MAKE_INCLUDE_PATH=C:\home\vcpkg\buildtrees\pcre\x64-windows-rel
CMake Error: Error processing file: C:/home/SoundBetter/frontend-sdl2/build/MAKE_INCLUDE_PATH=C:/home/vcpkg/buildtrees/pcre/x64-windows-rel
loading initial cache file MAKE_LIBRARY_PATH=C:\home\vcpkg\installed\x64-windows\lib
CMake Error: Error processing file: C:/home/SoundBetter/frontend-sdl2/build/MAKE_LIBRARY_PATH=C:/home/vcpkg/installed/x64-windows/lib
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
CMake Error at C:/home/SoundBetter/projectm/build/src/libprojectM/libprojectM/libprojectMConfig.cmake:39 (include):
  include could not find load file:

    C:/home/SoundBetter/projectm/build/src/libprojectM/libprojectM/libprojectMTargets.cmake
Call Stack (most recent call first):
  C:/home/vcpkg/scripts/buildsystems/vcpkg.cmake:555 (_find_package)
  CMakeLists.txt:37 (find_package)

CMake Error at C:/home/vcpkg/scripts/buildsystems/vcpkg.cmake:555 (_find_package):
  By not providing "FindPCRE.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "PCRE", but
  CMake did not find one.

  Could not find a package configuration file provided by "PCRE" with any of
  the following names:

    PCREConfig.cmake
    pcre-config.cmake

  Add the installation prefix of "PCRE" to CMAKE_PREFIX_PATH or set
  "PCRE_DIR" to a directory containing one of the above files.  If "PCRE"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  C:/home/vcpkg/installed/x64-windows/share/poco/PocoFoundationConfig.cmake:5 (find_dependency)
  C:/home/vcpkg/scripts/buildsystems/vcpkg.cmake:555 (_find_package)
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  C:/home/vcpkg/installed/x64-windows/share/poco/PocoUtilConfig.cmake:2 (find_dependency)
  C:/home/vcpkg/scripts/buildsystems/vcpkg.cmake:555 (_find_package)
  C:/home/vcpkg/installed/x64-windows/share/poco/PocoConfig.cmake:36 (find_package)
  C:/home/vcpkg/scripts/buildsystems/vcpkg.cmake:555 (_find_package)
  CMakeLists.txt:39 (find_package)

-- Configuring incomplete, errors occurred!
See also "C:/home/SoundBetter/frontend-sdl2/build/CMakeFiles/CMakeOutput.log".
See also "C:/home/SoundBetter/frontend-sdl2/build/CMakeFiles/CMakeError.log".

I have installed pcre and pcre2 through vcpkg. The files C:\home\vcpkg\installed\x64-windows\lib\pcre.lib and C:\home\vcpkg\installed\x64-windows\include\pcre.h both exist. Somehow CMake cannot find them.

kblaschke commented 2 years ago

Please check if your vcpkg triplet is set properly between all builds and package installs (e.g. x64-windows or x64-windows-static). If that's the case, POCO builds file in vcpkg, but downstream projects can't find it, it's a vcpkg bug - not much we can do about that. I'd then recommend creating a minimal CMake test project that exposes this issue and open a bug report in the vcpkg issue tracker. From my experience, they're quite fast at solving issues if you provide good information.

Here's a minimal CMakeLists.txt that you could use to test, just drop it anywhere and configure the build using the vcpkg toolchain file:

cmake_minimum_required(VERSION 3.15)
project(vcpkg_test)

find_package(Poco REQUIRED COMPONENTS Foundation)
file(WRITE ${CMAKE_CURRENT_LIST_DIR}/main.cpp "int main() { return 0; }")
add_executable(vcpkg-test main.cpp)
target_link_libraries(vcpkg-test PUBLIC Poco::Foundation)