On windows, a static build fails in the install step with errors like:
CMake Error at libs/glew/glew_dir/cmake_install.cmake:55 (file): file INSTALL cannot find
"C:/project/opencpn/plugin_src/build/bin/RelWithDebInfo/glew32.pdb": File exists.
This is about the following snippet in CMakeLists.txt:
if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1"))
install(
FILES $<TARGET_PDB_FILE:glew>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
CONFIGURATIONS Debug RelWithDebInfo
)
endif()
AFAICT <TARGET_PDB_FILE:glew> refers to the glew target which is the shared library even when doing a static build which makes the install command to fail (?)
Following patch against 2.2.0 makes the build to complete. I'm not convinced this is the correct solution, though.
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 419c243..2edf957 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -228,7 +228,10 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glew.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
-if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1"))
+if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600)
+ AND (NOT CMAKE_VERSION VERSION_LESS "3.1")
+ AND BUILD_SHARED_LIBS
+ )
EDIT: Fix the leading error message which was plain wrong.
On windows, a static build fails in the install step with errors like:
This is about the following snippet in CMakeLists.txt:
AFAICT
<TARGET_PDB_FILE:glew>refers to the glew target which is the shared library even when doing a static build which makes the install command to fail (?)Following patch against 2.2.0 makes the build to complete. I'm not convinced this is the correct solution, though.
EDIT: Fix the leading error message which was plain wrong.