59 Commits

Author SHA1 Message Date
Robert Edmonds
dd9b35d819 Bump version to 1.5.2 2025-04-06 21:14:19 -04:00
Robert Edmonds
51e4f9506c Bump version to 1.5.1 2025-02-01 23:04:03 -05:00
Robert Edmonds
417c759bbd cmake: Fix build when using ninja and protobuf-c already installed
If protobuf-c is already installed on the system, the cmake build can
generate an error like the following when using the ninja backend:

    edmonds@chase{0}:/tmp/protobuf-c$ cmake -S build-cmake -B build -G Ninja
    [...]

    edmonds@chase{0}:/tmp/protobuf-c$ ninja -v -C build
    ninja: Entering directory `build'
    [1/19] cd /tmp/protobuf-c/build && /usr/bin/cmake -E env PATH="/tmp/protobuf-c/build:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/edmonds/bin:/home/edmonds/.cargo/bin:/sbin:/bin:/usr/games" /usr/bin/protoc --cpp_out /tmp/protobuf-c/build -I/usr/include -I/tmp/protobuf-c /tmp/protobuf-c/protobuf-c/protobuf-c.proto
    FAILED: CMakeFiles/protoc-generated-files protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h /tmp/protobuf-c/build/CMakeFiles/protoc-generated-files /tmp/protobuf-c/build/protobuf-c/protobuf-c.pb.cc /tmp/protobuf-c/build/protobuf-c/protobuf-c.pb.h
    cd /tmp/protobuf-c/build && /usr/bin/cmake -E env PATH="/tmp/protobuf-c/build:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/edmonds/bin:/home/edmonds/.cargo/bin:/sbin:/bin:/usr/games" /usr/bin/protoc --cpp_out /tmp/protobuf-c/build -I/usr/include -I/tmp/protobuf-c /tmp/protobuf-c/protobuf-c/protobuf-c.proto
    /tmp/protobuf-c/protobuf-c/protobuf-c.proto: Input is shadowed in the --proto_path by "/usr/include/protobuf-c/protobuf-c.proto".  Either use the latter file as your input or reorder the --proto_path so that the former file's location comes first.
    [2/19] /usr/bin/cc -DPACKAGE_STRING="\"protobuf-c 1.5.0\"" -DPACKAGE_VERSION=\"1.5.0\" -I/tmp/protobuf-c -I/tmp/protobuf-c/protobuf-c -I/tmp/protobuf-c/build  -MD -MT CMakeFiles/protobuf-c.dir/tmp/protobuf-c/protobuf-c/protobuf-c.c.o -MF CMakeFiles/protobuf-c.dir/tmp/protobuf-c/protobuf-c/protobuf-c.c.o.d -o CMakeFiles/protobuf-c.dir/tmp/protobuf-c/protobuf-c/protobuf-c.c.o -c /tmp/protobuf-c/protobuf-c/protobuf-c.c
    ninja: build stopped: subcommand failed.
2025-01-25 22:31:34 -05:00
Robert Edmonds
cf8f97b5ba cmake: protoc-c/ → protoc-gen-c/ 2025-01-25 20:49:02 -05:00
Clément Péron
33e1af96d4 cmake: move to ctest 2024-04-28 12:48:11 +02:00
Clément Péron
0fa220a530 cmake: rework include rules
protoc-gen-c requires protobuf-c.

Properly set protobuf-c BUILD_INTERFACE.
To support both <protobuf-c/protobuf-c.h> and "protobuf-c.h"

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-28 12:27:12 +02:00
Clément Péron
6d2124a17f cmake: properly set PROTOBUF_INCLUDE_DIR in case we use Cmake config
Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-28 12:14:17 +02:00
Clément Péron
e0e9ee160b cmake: improve coherency leave endif() empty
Some endif are set, some are not.

Leave all the endif unset as it makes the code more readable.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-28 11:49:09 +02:00
Clément Péron
31d012a0a7 cmake: library source should only contains files to compile
Some executable and library add header files as source.
These should not be declared as source file, remove them.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-28 11:39:13 +02:00
Clément Péron
3e7c15881d cmake: format with cmake-format
CMake file is a bit a mess use:
cmake-format -i CMakeLists.txt

This will have a clean indent

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-28 11:33:11 +02:00
Clément Péron
af0ea6fac8 cmake: link with target to also get include directory
cxx-generate-packed-data needs to link with protobuf library for the C++
source file.

Use the protobuf::libprotobuf to get both library and include directory.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
49966f6c84 cmake: keep compatibility with CMake FindProtobuf module
PROTOBUF_PROTOC_EXECUTABLE is not set in the Protobuf CMake config file.
Set it properly in case we use CMake protobuf config file.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
1c954558f1 cmake: fix warning about policy CMP0145
Keep the DART compatibility enabled until test are moved
to CTest.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-22 09:58:56 +02:00
Clément Péron
be2c33276b cmake: fix recent protobuf build with cmake
The CMake module is used by default but isn't compatible with
recent protobuf version.

Try to first look for a protobuf config then fallback to legacy
cmake module.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
2024-04-21 14:57:31 +02:00
Alessandro Bono
9b1d4a355b CMakeList.txt: Remove double hyphens
Otherwise cmake won't reconize the command.

With double hyphens:
```
$ cmake -E env TESTENV=value -- env | grep TESTENV
cmake -E env: unknown option '--'
```

Without double hyphens:
```
$ cmake -E env TESTENV=value env | grep TESTENV
TESTENV=value
```
2023-12-15 19:49:09 +01:00
Robert Edmonds
6600fd55b9 Bump version to 1.5.0 2023-11-25 18:21:08 -05:00
Guybrush
5db0ca5a28 enforcing reviewers comments
Signed-off-by: Guybrush <miguel.barro@live.com>
2023-09-18 18:37:01 +02:00
Guybrush
6ad31f8d43 Dispatch workflow to generate binaries.
Led to some fixes in the CMake too.

Signed-off-by: Guybrush <miguel.barro@live.com>
2023-09-15 12:04:00 +02:00
MiguelBarro
61933280db Fix tests on windows by adding plugin dir to environment PATH
Signed-off-by: MiguelBarro <miguelbarro@eprosima.com>
2023-09-11 10:09:15 +02:00
MiguelBarro
01bd9bed77 Fixing static lib generation on MSVC
Signed-off-by: MiguelBarro <miguelbarro@eprosima.com>
2023-09-11 00:06:48 +02:00
Robert Edmonds
824a7fed75 cmake: Remove BUILD_PROTO3, HAVE_PROTO3 2023-07-08 23:15:14 -04:00
Robert Edmonds
0ce231b16d cmake: Add -I${PROTOBUF_INCLUDE_DIR} to protoc invocation
Apparently in some cases the protobuf compiler is unable to find its own
files, and this fix has been reported to work.

See https://github.com/protobuf-c/protobuf-c/issues/491.
2023-07-08 21:18:06 -04:00
Robert Edmonds
7582b6e7d6 cmake: Require C++17
Newer versions of protobuf apparently don't build with older versions of
the C++ standard.
2023-07-02 22:58:48 -04:00
aviborg
8fd6cf4b88 remove deprecated functionality (#542)
Co-authored-by: Andreas Viborg <andreas.viborg@maxar.com>
Co-authored-by: Robert Edmonds <edmonds@users.noreply.github.com>
2023-07-02 02:39:10 -04:00
Robert Edmonds
5f2aa966de Merge pull request #482 from KivApple/master
Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR
2023-07-02 02:19:16 -04:00
Robert Edmonds
484e6b98b2 Merge pull request #472 from morrisonlevi/cmake-targets
Export and install CMake targets
2023-07-02 02:11:05 -04:00
Robert Edmonds
a0a0131c89 Bump version to 1.4.1 2022-07-10 21:33:59 -04:00
Ivan KOLESNIKOV
500256bb37 Replace more CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR 2021-07-28 14:26:58 +02:00
Ivan KOLESNIKOV
6957eb54eb Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR to improve compatibility (especially with building using add_subdirectory) 2021-07-28 13:36:37 +02:00
Robert Edmonds
a124b38608 Bump version to 1.4.0 2021-05-18 20:28:48 -04:00
Levi Morrison
9fd8df92ca Export and install CMake targets
The steps to add this functionality are from the cmake tutorial:
https://cmake.org/cmake/help/latest/guide/tutorial/index.html

The include directories being set on the targets is necessary
for dependent targets. There is some redundancy with the
INCLUDE_DIRECTORIES calls alreday present, but I left it alone
to make the PR smaller and more approachable.

The project currently uses mixed cases in functions. This uses
lowercase on calls I touched, as this is what CMake documentation
uses and seems to be the preferred way.

I also started wrapping long lines, as some of the lines I touched
were over 170 characters.

I tested this on both Mac OS 10.15 Catalina and CentOS 7 (with
devtoolset-7) with CMake 3.10.3.
Will work on tests in CI next.
2021-04-12 18:42:47 -06:00
Robert Edmonds
5ae0762b85 Merge branch 'next' into options 2021-04-06 19:57:36 -04:00
Ilya Lipnitskiy
0e060260f0 protoc-c: add custom options support 2021-03-21 20:28:33 -07:00
Ilya Lipnitskiy
e79f7d3ac6 cmake: use static build by default, fix MSVC build
Matches protobuf default behavior:
https://github.com/protocolbuffers/protobuf/tree/master/cmake#dlls-vs-static-linking

Bump min cmake version to use Protobuf_USE_STATIC_LIBS:
https://cmake.org/cmake/help/latest/module/FindProtobuf.html
2021-03-15 18:01:47 -07:00
Robert Edmonds
32f0a781c7 Merge pull request #456 from ppietrasa/master
Install debug symbols alongside the protobuf-c.lib
2021-02-18 21:21:46 -05:00
Piotr Pietraszkiewicz
f53a8c98ad Install debug symbols alongside the protobuf-c.lib
A user of the protobuf-c library is confronted with MSVC warnings about missing
PDB if the library happens to be built/configured using the CMAKE_BUILD_TYPE
"Debug" or "RelWithDebInfo". This commit deals away with the warning by
installing the "protobuf-c.pdb" alongside the lib. The .pdb is installed only
if it exists. Configuring "Release" or building under Linux won't produce and
won't install the PDB.
2021-02-08 13:58:52 +01:00
Ilya Lipnitskiy
2102d3a2c5 CMakeLists.txt: Don't include Dart if no tests
Also use BUILD_TESTS instead of CMAKE_BUILD_TYPE in other places in the
file.
2020-05-13 13:38:34 -07:00
James Benton
e01b30d4fe Add BUILD_TESTS option to CMake build. 2020-05-12 10:21:30 -07:00
Ilya Lipnitskiy
12973e7f3f CMakeLists.txt: Add option to disable protoc-gen-c 2020-05-09 15:08:28 -07:00
Ilya Lipnitskiy
3d3b5fe220 CMakeLists.txt: Enforce C++11 for old compilers 2020-05-09 14:29:06 -07:00
Ilya Lipnitskiy
ce75229b6a CMakeLists.txt: Fix protoc-c crashes on Linux
-lpthread was missing from the linker command line. See
https://github.com/protocolbuffers/protobuf/issues/5107 for more
details.

.travis.yml: Run CMake debug build for verification
2020-05-09 13:27:33 -07:00
Ilya Lipnitskiy
db6c49cc43 CMakeLists.txt: Add pkg-config logic (Fixes #339) 2020-05-09 13:27:23 -07:00
Robert Edmonds
d0531beaad Bump version to 1.3.3 2019-12-04 16:08:05 -05:00
Robert Edmonds
e7c18ecda7 Merge pull request #350 from msshapira/patch-2
fix suport for MSVC static build
2019-12-04 13:35:36 -05:00
Markus Engel
687f27726c Fixed endianness check for cmake
Signed-off-by: Markus Engel <engel@sero-systems.de>
2019-10-18 21:23:55 -04:00
Robert Edmonds
62ecf2b467 Bump version to 1.3.2 2019-06-24 00:37:47 -04:00
msshapira
4d9d0614d4 fix suport for MSVC static build 2018-11-12 17:43:59 +02:00
Robert Edmonds
53bf6c0b7c Bump version to 1.3.1 2018-08-13 23:18:25 -04:00
Robert Edmonds
25cb6e2bdf Bump version to 1.3.0 2017-07-29 19:30:36 -04:00
alex85k
58a4514164 fixing tests building in CMake 2017-04-10 18:42:59 +05:00