You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build paho.mqtt.cpp in a docker container and cmake doesn't pick up my c++ compiler correctly:
CMake Error at src/CMakeLists.txt:94 (target_compile_options):
Error evaluating generator expression:
$<CXX_COMPILER_ID:MSVC,Clang>
$<CXX_COMPILER_ID> expression requires one or zero parameters.
The container is based on Ubuntu 18.04 and it doesn't have MSVC.
paho.mqtt.c builds just fine.
I've tried setting the CXX environment variables and that didn't help.
Also tried the cmake option -DCMAKE_CXX_COMPILER=clang++ and that didn't help either.
The relevant lines from my Dockerfile are:
paho_mqtt_c
RUN git clone --no-checkout https://github.com/eclipse/paho.mqtt.c.git /usr/src/paho_mqtt_c &&
cd /usr/src/paho_mqtt_c &&
git checkout tags/v1.3.13 &&
mkdir /usr/src/paho_mqtt_c/build &&
cd /usr/src/paho_mqtt_c/build &&
cmake /usr/src/paho_mqtt_c &&
make &&
make install
paho_mqtt_cpp
RUN git clone --no-checkout https://github.com/eclipse/paho.mqtt.cpp.git /usr/src/paho_mqtt_cpp &&
cd /usr/src/paho_mqtt_cpp &&
git checkout tags/v1.3.1 &&
mkdir /usr/src/paho_mqtt_cpp/build &&
cd /usr/src/paho_mqtt_cpp/build &&
cmake /usr/src/paho_mqtt_cpp -DCMAKE_CXX_COMPILER=clang++ -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=FALSE && -DPAHO_MQTT_C_PATH=/usr/src/paho_mqtt_c .
make &&
make install &&
rm -rf /usr/src/paho_mqtt_cpp &&
rm -rf /usr/src/paho_mqtt_c
The text was updated successfully, but these errors were encountered:
Oh. Someone recently reported this in one of my other C++ projects.
It’s a CMake thing.
I’m guessing that you’re using a version of CMake older than 3.15. Before that, CXX_COMPILER_ID didn’t allow multiple IDs. But I didn’t realize that and copy/pasted this into a couple of my projects that were claiming to be compliant with older versions.
I was literally going to fix it in the other project this evening. If it works, I’ll fix it here, too
OK. That confirms it. But no worries, I'll get it fixed. The build claims to work back to CMake v3.5, and I will make sure that remains true for this version of the library.
In the meantime, if you want to patch and build on your system, in src/CMakeLists.txt, at around line 97, there's a line:
I'm trying to build paho.mqtt.cpp in a docker container and cmake doesn't pick up my c++ compiler correctly:
CMake Error at src/CMakeLists.txt:94 (target_compile_options):
Error evaluating generator expression:
$<CXX_COMPILER_ID:MSVC,Clang>
$<CXX_COMPILER_ID> expression requires one or zero parameters.
The container is based on Ubuntu 18.04 and it doesn't have MSVC.
paho.mqtt.c builds just fine.
I've tried setting the CXX environment variables and that didn't help.
Also tried the cmake option -DCMAKE_CXX_COMPILER=clang++ and that didn't help either.
The relevant lines from my Dockerfile are:
paho_mqtt_c
RUN git clone --no-checkout https://github.com/eclipse/paho.mqtt.c.git /usr/src/paho_mqtt_c &&
cd /usr/src/paho_mqtt_c &&
git checkout tags/v1.3.13 &&
mkdir /usr/src/paho_mqtt_c/build &&
cd /usr/src/paho_mqtt_c/build &&
cmake /usr/src/paho_mqtt_c &&
make &&
make install
paho_mqtt_cpp
RUN git clone --no-checkout https://github.com/eclipse/paho.mqtt.cpp.git /usr/src/paho_mqtt_cpp &&
cd /usr/src/paho_mqtt_cpp &&
git checkout tags/v1.3.1 &&
mkdir /usr/src/paho_mqtt_cpp/build &&
cd /usr/src/paho_mqtt_cpp/build &&
cmake /usr/src/paho_mqtt_cpp -DCMAKE_CXX_COMPILER=clang++ -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=FALSE && -DPAHO_MQTT_C_PATH=/usr/src/paho_mqtt_c .
make &&
make install &&
rm -rf /usr/src/paho_mqtt_cpp &&
rm -rf /usr/src/paho_mqtt_c
The text was updated successfully, but these errors were encountered: