LiamBindle / MQTT-C

A portable MQTT C client for embedded systems and PCs alike.
https://liambindle.ca/MQTT-C
MIT License
766 stars 269 forks source link

Add 'OPENSSL_INCLUDE_DIR' to CMakeLists.txt #146

Closed alvin1221 closed 2 years ago

LiamBindle commented 2 years ago

Thanks @alvin1221! Just checking---is there an issue with the OprnSSL::SSL imported target? I thought the include directories were included in that target.

alvin1221 commented 2 years ago

Here's the issue if did not set OPENSSL_INCLUDE_DIR on MacOS or Corss-compile for arm-linux-gnueabihf/aarch64-linux-gnu

Building MQTT-C (1.1.5)
-- The C compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found OpenSSL: /usr/local/opt/openssl/lib/libcrypto.dylib (found version "1.1.1k")  
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/externs/MQTT-C/build
[1/3] Building C object CMakeFiles/mqttc.dir/src/mqtt_pal.c.o
FAILED: CMakeFiles/mqttc.dir/src/mqtt_pal.c.o 
/Library/Developer/CommandLineTools/usr/bin/cc -DMQTT_USE_BIO -I../include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -MD -MT CMakeFiles/mqttc.dir/src/mqtt_pal.c.o -MF CMakeFiles/mqttc.dir/src/mqtt_pal.c.o.d -o CMakeFiles/mqttc.dir/src/mqtt_pal.c.o -c ../src/mqtt_pal.c
In file included from ../src/mqtt_pal.c:25:
In file included from ../include/mqtt.h:43:
../include/mqtt_pal.h:100:22: fatal error: 'openssl/bio.h' file not found
            #include <openssl/bio.h>
                     ^~~~~~~~~~~~~~~
1 error generated.
[2/3] Building C object CMakeFiles/mqttc.dir/src/mqtt.c.o
FAILED: CMakeFiles/mqttc.dir/src/mqtt.c.o 
/Library/Developer/CommandLineTools/usr/bin/cc -DMQTT_USE_BIO -I../include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -MD -MT CMakeFiles/mqttc.dir/src/mqtt.c.o -MF CMakeFiles/mqttc.dir/src/mqtt.c.o.d -o CMakeFiles/mqttc.dir/src/mqtt.c.o -c ../src/mqtt.c
In file included from ../src/mqtt.c:25:
In file included from ../include/mqtt.h:43:
../include/mqtt_pal.h:100:22: fatal error: 'openssl/bio.h' file not found
            #include <openssl/bio.h>
                     ^~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
[1/4] Building C object CMakeFiles/mqttc.dir/src/mqtt_pal.c.o
FAILED: CMakeFiles/mqttc.dir/src/mqtt_pal.c.o 
/Library/Developer/CommandLineTools/usr/bin/cc -DMQTT_USE_BIO -I../include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -MD -MT CMakeFiles/mqttc.dir/src/mqtt_pal.c.o -MF CMakeFiles/mqttc.dir/src/mqtt_pal.c.o.d -o CMakeFiles/mqttc.dir/src/mqtt_pal.c.o -c ../src/mqtt_pal.c
In file included from ../src/mqtt_pal.c:25:
In file included from ../include/mqtt.h:43:
../include/mqtt_pal.h:100:22: fatal error: 'openssl/bio.h' file not found
            #include <openssl/bio.h>
                     ^~~~~~~~~~~~~~~
1 error generated.
[2/4] Building C object CMakeFiles/mqttc.dir/src/mqtt.c.o
FAILED: CMakeFiles/mqttc.dir/src/mqtt.c.o 
/Library/Developer/CommandLineTools/usr/bin/cc -DMQTT_USE_BIO -I../include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -fPIC -MD -MT CMakeFiles/mqttc.dir/src/mqtt.c.o -MF CMakeFiles/mqttc.dir/src/mqtt.c.o.d -o CMakeFiles/mqttc.dir/src/mqtt.c.o -c ../src/mqtt.c
In file included from ../src/mqtt.c:25:
In file included from ../include/mqtt.h:43:
../include/mqtt_pal.h:100:22: fatal error: 'openssl/bio.h' file not found
            #include <openssl/bio.h>
                     ^~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
LiamBindle commented 2 years ago

Thanks @alvin1221!