Catkin_make on the velodyne drivers fails in the windows 10 environemnt - windows

I am trying to install the ROS-Velodyne drivers(https://github.com/ros-drivers/velodyne) in windows to capture the point cloud from velodyne LiDAR but getting error while running catkin_make.
Since these drivers require pcap library, i installed WinPcap in my system and updated the cmake of velodyne driver to find the required headers and link the library.
But on running the cmake, i am getting error on "target_link_libraries" (image shown)
Cannot specify link libraries for target "velodyne_driver" which is not
built by this project
Following is the cmake file of velodyne_driver package:
cmake_minimum_required(VERSION 2.8.3)
project(velodyne_driver)
# Set minimum C++ standard to C++11
if (NOT "${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}")
message(STATUS "Changing CXX_STANDARD from C++98 to C++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}" STREQUAL "98")
message(STATUS "Changing CXX_STANDARD from C++98 to C++11")
set(CMAKE_CXX_STANDARD 11)
endif()
set(${PROJECT_NAME}_CATKIN_DEPS
diagnostic_updater
dynamic_reconfigure
nodelet
roscpp
tf
velodyne_msgs)
find_package(catkin REQUIRED COMPONENTS ${${PROJECT_NAME}_CATKIN_DEPS} roslint)
# This driver uses Boost threads
find_package(Boost REQUIRED COMPONENTS thread)
# kinger: libpcap provides no pkg-config or find_package module:
#message (STATUS "****** Starting PCAP Search in folder: ********")
set( PCAP_DIR "C:/workspace/WpdPack" )
#message (STATUS ${PCAP_DIR})
#kinger: Include file FindPCAP.cmake
include(FindPCAP.cmake)
#find_package( PCAP REQUIRED )
message (STATUS "******* FIND PCAP TASK FINISHED **********")
message (STATUS ${PCAP_FOUND})
message (STATUS ${PCAP_INCLUDE_DIRS})
message (STATUS ${PCAP_LIBRARY_DIRS})
message (STATUS ${PCAP_LIBRARIES})
#set(libpcap_LIBRARIES -lpcap)
if(PCAP_FOUND)
# Include Directories
include_directories( ${PCAP_INCLUDE_DIRS} )
# Library Directories (Option)
link_directories( ${PCAP_LIBRARY_DIRS} )
# Dependencies
target_link_libraries( ${PROJECT_NAME} ${PCAP_LIBRARIES} )
endif()
include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS})
# Generate dynamic_reconfigure server
generate_dynamic_reconfigure_options(cfg/VelodyneNode.cfg)
# objects needed by other ROS packages that depend on this one
catkin_package(CATKIN_DEPENDS ${${PROJECT_NAME}_CATKIN_DEPS}
INCLUDE_DIRS include
LIBRARIES velodyne_input)
# compile the driver and input library
add_subdirectory(src/lib)
add_subdirectory(src/driver)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(FILES nodelet_velodyne.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(PROGRAMS src/vdump
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
roslint_cpp()
if (CATKIN_ENABLE_TESTING)
# these dependencies are only needed for unit testing
find_package(roslaunch REQUIRED)
find_package(rostest REQUIRED)
# Download packet capture (PCAP) files containing test data.
# Store them in devel-space, so rostest can easily find them.
catkin_download_test_data(
${PROJECT_NAME}_tests_class.pcap
http://download.ros.org/data/velodyne/class.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 65808d25772101358a3719b451b3d015)
catkin_download_test_data(
${PROJECT_NAME}_tests_32e.pcap
http://download.ros.org/data/velodyne/32e.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 e41d02aac34f0967c03a5597e1d554a9)
catkin_download_test_data(
${PROJECT_NAME}_tests_vlp16.pcap
http://download.ros.org/data/velodyne/vlp16.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 f45c2bb1d7ee358274e423ea3b66fd73)
# unit tests
add_rostest(tests/pcap_node_hertz.test)
add_rostest(tests/pcap_nodelet_hertz.test)
add_rostest(tests/pcap_32e_node_hertz.test)
add_rostest(tests/pcap_32e_nodelet_hertz.test)
add_rostest(tests/pcap_vlp16_node_hertz.test)
add_rostest(tests/pcap_vlp16_nodelet_hertz.test)
# parse check all the launch/*.launch files
roslaunch_add_file_check(launch)
# unit test
catkin_add_gtest(time_test tests/timeconversiontest.cpp)
target_link_libraries(time_test
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${PCAP_LIBRARIES})
endif (CATKIN_ENABLE_TESTING)
UPDATE: Resolved the above issue. It was related to target_link_libraries where we need to provide the "target" and not the "project". I updated the cmake by adding this line:
set(libpcap_LIBRARIES ${PCAP_LIBRARIES})
Now, the build fails at 59% with following error:
C:\opt\ros\noetic\x64\include\diagnostic_updater/update_functions.h(188): error C2589: 'constant': illegal token on right side of '::'
Looks like this is an open issue: https://github.com/ms-iot/ROSOnWindows/issues/280

I'm happy to see that you are using ROS on Windows! I'd love to know more about your project.
We (Azure Edge Robotics, who maintain ROS on Windows) don't currently have a Velodyne lidar, so have not attempted to port it.
It looks like the Velodyne Lidar ROS node has not been enabled on Windows. It looks like there are several linux specific commands in the cmake file which need windows equivalents.
We have a porting guide for Windows here - https://ms-iot.github.io/ROSOnWindows/GettingStarted/PortingANode.html
It there is a winpcap vcpkg which can be leveraged in the port:
https://github.com/microsoft/vcpkg/tree/master/ports/winpcap
I've created this on the ROSonWindows github to track:
Catkin_make on the velodyne drivers fails in the windows 10 environemnt

Related

CMake Error at runner/CMakeLists.txt:9 (add_executable): ( Flutter windows ) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I was working on a flutter project for android and I wanted to use it for windows to then I run it on windows x64 from vs code then I got that error
Launching lib\main.dart on Windows in debug mode...
CMake Error at runner/CMakeLists.txt:9 (add_executable):
Cannot find source file:
runner.exe.manifest
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
CMake Error at runner/CMakeLists.txt:9 (add_executable):
No SOURCES given to target: school_manager
CMake Generate step failed. Build files cannot be regenerated correctly.
Exception: Unable to generate build files
Exited (sigterm)
Here is my C:\flutter projects\school_manager\windows\flutter\CMakeLists.txt:
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.14)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"flutter_export.h"
"flutter_windows.h"
"flutter_messenger.h"
"flutter_plugin_registrar.h"
"flutter_texture_registrar.h"
)
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
add_dependencies(flutter flutter_assemble)
# === Wrapper ===
list(APPEND CPP_WRAPPER_SOURCES_CORE
"core_implementations.cc"
"standard_codec.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
"plugin_registrar.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_APP
"flutter_engine.cc"
"flutter_view_controller.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
# Wrapper sources needed for a plugin.
add_library(flutter_wrapper_plugin STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
)
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_plugin flutter_assemble)
# Wrapper sources needed for the runner.
add_library(flutter_wrapper_app STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_APP}
)
apply_standard_settings(flutter_wrapper_app)
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
target_include_directories(flutter_wrapper_app PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_app flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
${PHONY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
)
and here is my C:\flutter projects\school_manager\windows\runner\CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME} WIN32
"flutter_window.cpp"
"main.cpp"
"utils.cpp"
"win32_window.cpp"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
"Runner.rc"
"runner.exe.manifest"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
# Add dependency libraries and include directories. Add any application-specific
# dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
I tried to download cMake file from cMake.org and add it to system environment variables but it did not work or maybe I did it wrong

How to make Qt libraries a component in cpack installer?

I'm trying to build a Qt installer for my app using CMake and CPack with it's CPackIFW plugin. I'm using Windows. I've defined the main application component and a library, they both appear in the installer and are installed correctly. I also have a CPack pre-build script that runs windeployqt and adds the DLLs required by the application. However, as the DLLs are copied into the same folder as the main executable, I can't make them separate components. Is there a way to separate my artifacts from Qt DLLs and still be able to run the application after installation?
Here's my CMakeLists:
cmake_minimum_required(VERSION 3.22)
project(untitled-bot VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets HttpServer TextToSpeech Sql)
qt_standard_project_setup()
set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/main.rc")
set(PROJECT_SOURCES
# sources here
)
qt_add_executable(untitled-bot
MANUAL_FINALIZATION
${PROJECT_SOURCES}
${app_icon_resource_windows}
)
set(executable_path "\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:untitled-bot>")
qt_finalize_executable(untitled-bot)
add_subdirectory(external/lua)
target_link_libraries(untitled-bot
PRIVATE lua::lib
PRIVATE Qt6::Widgets
PRIVATE Qt6::HttpServer
PRIVATE Qt6::TextToSpeech
PRIVATE Qt6::Sql
)
target_include_directories(
untitled-bot
PRIVATE external/sol
)
set_target_properties(untitled-bot PROPERTIES
WIN32_EXECUTABLE TRUE
)
add_custom_target(copy_assets
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/scripts ${CMAKE_CURRENT_BINARY_DIR}/scripts
)
add_dependencies(untitled-bot copy_assets)
include(GNUInstallDirs)
install(TARGETS untitled-bot
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT main_app
)
install(TARGETS lua
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT main_app
)
#I think this should have added the dependencies component to the installer, but it didn't; however, the runtime DLLs are still added by `windeployqt` so this step can be omitted, I guess
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT runtime_dependencies)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "IFW")
set(CPACK_IFW_ROOT "I:/Qt/Tools/QtInstallerFramework/4.4/")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set (CPACK_IFW_PACKAGE_NAME "application")
set (CPACK_IFW_PACKAGE_TITLE "application Installer")
set (CPACK_IFW_PACKAGE_WIZARD_STYLE "Modern")
set (CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST ON)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
find_program(WINDEPLOYQT windeployqt HINTS "${_qt_bin_dir}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/deploy-qt-windows.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/deploy-qt-windows.cmake" #ONLY)
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/deploy-qt-windows.cmake)
set(CPACK_IFW_VERBOSE true)
include(CPack)
include(CPackIFW)
message(STATUS "${WORK_BIN_DIR}")
# this appears in the installer and is installed correctly; however, Qt DLLs are also part of the "main application" component
cpack_add_component(main_app DISPLAY_NAME "Main Application" DESCRIPTION "aaa" REQUIRED)
# this doesn't appear in the installer
cpack_add_component(runtime_dependencies DISPLAY_NAME "runtime dependencies" DESCRIPTION "bbb" REQUIRED)
# List controlling which components are installed
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
# I also tried using set(CPACK_COMPONENTS_ALL "main_app;runtime_dependencies") but it doesn't add runtime libraries to the selection list
#set(CPACK_COMPONENTS_ALL main_app)
# in my case this only shows main_app
message(STATUS "CPACK_COMPONENTS_ALL = " ${CPACK_COMPONENTS_ALL})
# Install the runtime libs
cpack_ifw_configure_component(runtime_dependencies ESSENTIAL FORCED_INSTALLATION)
# The main app component HAS to be installed
cpack_ifw_configure_component(main_app ESSENTIAL FORCED_INSTALLATION)
# Adds license info to package.xml file
# Also copies licence.txt to 'meta' directory to display the license text in the installer.
cpack_ifw_configure_component(main_app LICENSES "GPLv3" ${CPACK_RESOURCE_FILE_LICENSE})
deploy-qt-windows.cmake.in:
set(WINDEPLOYQT "#WINDEPLOYQT#")
execute_process(COMMAND ${WINDEPLOYQT} "--no-quick-import" "--no-translations" "--no-system-d3d-compiler" "--no-opengl-sw" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/main_app/data/bin")
It copies the required Qt libraries to the bin directory containing the application exe and they are picked up by CPack as part of the main app component.
Can you help me fix this?
Update: edited the original question to remove one of the problems, the one stated in the title still persists

Gtest discover_tests failing in Github Actions: Process terminated due to timeout

I am using google-test(gtest) with CMake and running the unit tests as GitHub ci jobs for Linux and Mac. The Linux jobs pass successfully. However, I am getting an error for the mac runner.
The error is
CMake Error at /usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:77 (message):
Error running test executable.
Path: '/Users/runner/work/splitwebp/build/test/splitwebp_tests'
Result: Process terminated due to timeout
Output:
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.21.1/share/cmake/Modules/GoogleTestAddTests.cmake:173 (gtest_discover_tests_impl)
This is the CMakelists.txt for the tests directory
# CMake config file for unit tests
# Requiring V 3.10 for gtest_discover_tests
cmake_minimum_required(VERSION 3.10)
find_package(OpenCV REQUIRED)
enable_testing()
# finds all .cpp files under this directory (./test) and add them to executable
file(GLOB_RECURSE tests "*.cpp")
file(GLOB_RECURSE source "../src/*.cpp")
add_executable(splitwebp_tests ${tests} ${source})
include_directories("../3rdparty/libwebp/include")
# Link gtest libraries
target_link_libraries(splitwebp_tests ${OpenCV_LIBS})
target_link_libraries(splitwebp_tests webp webpdemux pthread)
target_link_libraries(splitwebp_tests gtest_main)
set(CTEST_OUTPUT_ON_FAILURE 1)
# Find all tests in all .cpp files and convert to CTests
include(GoogleTest)
gtest_discover_tests(splitwebp_tests)
How do I fix the CI pipeline?
The problem is gtest_discover_tests(...) is taking too long and thus getting timed out. The obvious solution is to increase the timeout limit.
The line
gtest_discover_tests(splitwebp_tests)
can be replaced with
gtest_discover_tests(splitwebp_tests PROPERTIES TIMEOUT 600)

Set installation for Windows 10 to specify drive letter and path without spaces

I am trying to create a Windows installer using CPACK and NSIS. I am using Windows 10, CMake GUI, NSIS, and Visual Studio Community Edition.
It works great except that I can't find the options so that the default install location will be:
C:\package-version.patch (e.g. C:\apbs-3.0)
The apbs software is a collaboration effort and is cross platform but it does not like "spaces" in pathnames so the default location for NSIS on Windows 10 x64 is:
C:\Program Files\package version (e.g. C:\Program Files\apbs 3.0\)
The closest I have gotten to is:
C:\\apbs 3.0
using the following configuration:
string(TOLOWER ${PROJECT_NAME} PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
set(CPACK_PACKAGE_DESCRIPTION "${PACKAGE_DESC}")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE.md")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGING_INSTALL_PREFIX "${PACKAGE_NAME}")
set(CPACK_PACKAGE_VERSION "${APBS_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VENDOR "${VENDOR}")
set(CPACK_PACKAGE_CONTACT "${CONTACT}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${APBS_VERSION}")
set(CPACK_STRIP_FILES ON)
if(WIN32)
# From: https://martinrotter.github.io/it-programming/2014/05/09/integrating-nsis-cmake/
list(APPEND CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGING_INSTALL_PREFIX "\\\\${PACKAGE_NAME}-${APBS_VERSION}")
set(CPACK_NSIS_INSTALL_ROOT "C:\\\\")
endif()
include (CPack)
Is there a magic/undocumented set of CPACK variables to eliminate the extra '\' and replace the "space" with a '-' so that I can get the default install to be?
C:\apbs-3.0\
The following got me the install directory, C:\APBS-3.0.0
set(CMAKE_MAJOR_VERSION "3")
set(CMAKE_MINOR_VERSION "0")
set(CMAKE_MICRO_VERSION "0")
set(PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
set(CPACK_PACKAGE_DESCRIPTION "APBS - Adaptive Poisson Boltzmann Solver")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE.md")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore")
set(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_MICRO_VERSION}")
set(CPACK_PACKAGE_VENDOR "PNNL")
set(CPACK_PACKAGE_CONTACT "APBS - https://github.com/Electrostatics/apbs-pdb2pqr")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${APBS_VERSION}")
set(CPACK_STRIP_FILES ON)
if(WIN32)
# From: https://martinrotter.github.io/it-programming/2014/05/09/integrating-nsis-cmake/
SET(CPACK_NSIS_PACKAGE_NAME "${PACKAGE_NAME}-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_MICRO_VERSION}")
SET(CPACK_NSIS_DISPLAY_NAME "${PACKAGE_NAME}-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_MICRO_VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PACKAGE_NAME}-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_MICRO_VERSION}")
SET(CPACK_NSIS_INSTALL_ROOT "C:")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PACKAGE_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}")
list(APPEND CPACK_GENERATOR "NSIS")
endif()
Hopefully this can help others looking for similar solutions.

Building protobuf 3.9.4 on windows with cmake

I'm trying to build protobuf 3.9.4 on windows with cmake, but when i click 'configure', I get a message saying 'LINK : fatal error LNK1101: incorrect MSPDB140.DLL version; recheck installation of this product'.
Does anybody have any clue what's going on here?
Something's wrong with Visual Studio, most likely, but I'm not sure what.
I tried googling for solutions, but none of them relate to my problem.
P.S.
I'm using the gui version of cmake.
There is an useful example of CMake scripts patching needed to build protobuf 3.4.1 with Visual Studio 2017 using vcpkg.
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 7618ba2..d282a60 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
## -165,8 +165,10 ## endif (protobuf_UNICODE)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
-include(libprotoc.cmake)
-include(protoc.cmake)
+if(protobuf_BUILD_COMPILER)
+ include(libprotoc.cmake)
+ include(protoc.cmake)
+endif()
if (protobuf_BUILD_TESTS)
include(tests.cmake)
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 441bf55..20b3aa0 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
## -1,14 +1,17 ##
include(GNUInstallDirs)
+set(LIBRARIES_TO_SET_DEST libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+ list(APPEND LIBRARIES_TO_SET_DEST libprotoc)
+endif()
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc #ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc #ONLY)
foreach(_library
- libprotobuf-lite
- libprotobuf
- libprotoc)
+ ${LIBRARIES_TO_SET_DEST})
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
## -19,8 +22,10 ## foreach(_library
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()
-install(TARGETS protoc EXPORT protobuf-targets
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+if(protobuf_BUILD_COMPILER)
+ install(TARGETS protoc EXPORT protobuf-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
## -101,7 +106,12 ## configure_file(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake #ONLY)
# Allows the build directory to be used as a find directory.
-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+set(FIND_DIRS libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+ list(APPEND FIND_DIRS libprotoc protoc)
+endif()
+
+export(TARGETS ${FIND_DIRS}
NAMESPACE protobuf::
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
)
Most probably easiest way to get 3.9.4 building is to upgrade original protobuf 3.4.1 vcpkg port. My experience with building C/C++ ports using vcpkg is a positive one so far.

Resources