Reputation: 1323
I have problems with following part of code from PocoMacros.cmake file:
# CMAKE_MC_COMPILER - where to find mc.exe
if (WIN32)
# cmake has CMAKE_RC_COMPILER, but no message compiler
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# this path is only present for 2008+, but we currently require PATH to
# be set up anyway
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
if (X64)
set(sdk_bindir "${sdk_dir}/bin/x64")
set(kit_bindir "${kit_dir}/bin/x64")
set(kit81_bindir "${kit81_dir}/bin/x64")
else (X64)
set(sdk_bindir "${sdk_dir}/bin")
set(kit_bindir "${kit_dir}/bin/x86")
set(kit81_bindir "${kit81_dir}/bin/x86")
endif (X64)
endif ()
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
DOC "path to message compiler")
if (NOT CMAKE_MC_COMPILER)
message(FATAL_ERROR "message compiler not found: required to build")
endif (NOT CMAKE_MC_COMPILER)
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}")
mark_as_advanced(CMAKE_MC_COMPILER)
endif(WIN32)
So when trying to build library I always got an error:
message compiler not found: required to build
As you can see since my cmake generator set to "MinGW Makefiles", poco doesn't set path for directories kit_bindir
, kit81_bindir
and sdk_bindir
.
I've tried to set -Dkit_bindir= "C:/Program Files (x86)/Windows Kits/8.1/bin/x86/"
but build still fails. Also I can't preset CMAKE_MC_COMPILER, since it will be redefined anyway. Official poco tutorial seems useless.
The main question is how to avoid using message compiler by pocolib or how to predefine path to mc.exe? Thanks.
UPDATE 1
I'm using POCO release v.1.7.6. Version 1.7.7 released still nothing changed. Maybe there some good ports to CMake I could use?
UPDATE 2 thanks to @sourcedelica
For Poco 1.9.0 you just need to install Windows SDKs and then add C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\x64 to PATH after
Upvotes: 5
Views: 3084
Reputation: 2684
I think I found a solution, in PocoMacros.cmake is code:
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# this path is only present for 2008+, but we currently require PATH to
# be set up anyway
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
if (X64)
set(sdk_bindir "${sdk_dir}/bin/x64")
set(kit_bindir "${kit_dir}/bin/x64")
set(kit81_bindir "${kit81_dir}/bin/x64")
else (X64)
set(sdk_bindir "${sdk_dir}/bin")
set(kit_bindir "${kit_dir}/bin/x86")
set(kit81_bindir "${kit81_dir}/bin/x86")
endif (X64)
endif ()
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
DOC "path to message compiler")
so as you see some necessairy configurations are availabilable only if ${CMAKE_GENERATOR} is "Visual Studio", and unfortunately there is no more Windows Generators available. As you see necessairy is mc.exe, which is available with Visual Studio, but if you don't have VS (as I don't) you need to download and install Microsoft SDKs. Then look to settings:
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
set(sdk_bindir "${sdk_dir}/bin/")
you need to copy them just before:
find_program(CMAKE_MC_COMPILER MC.Exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
This worked for me and I saw: "Configuring done Generating done" in CMake
Upvotes: 3