1
0
Fork 0

Tentative fix for the MSVC build

When building with MSVC, use the CMAKE_MSVCIDE_RUN_PATH variable to
prepend ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin to the PATH in
order to (hopefully) allow fgrcc to find the libraries it needs. We may
need to add something similar for SimGear---will see.

The use of CMAKE_MSVCIDE_RUN_PATH and other ways to address this problem
are discussed at
<https://stackoverflow.com/questions/28533012/how-to-set-runtime-path-for-cmake-custom-command-on-windows>.
This commit is contained in:
Florent Rougon 2017-06-13 17:58:21 +02:00
parent f55fd3f10c
commit 0855f0414f

View file

@ -44,6 +44,16 @@ set(HEADERS
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
)
# On Windows, make sure fgrcc can be run (it needs third-party libraries)
if (MSVC)
if (MSVC_3RDPARTY_ROOT AND MSVC_3RDPARTY_DIR)
set(CMAKE_MSVCIDE_RUN_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin)
else ()
message(FATAL_ERROR
"Either MSVC_3RDPARTY_ROOT or MSVC_3RDPARTY_DIR is empty or unset")
endif ()
endif ()
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx