ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Passing LDFLAGS and CPPFLAGS to catkin_make

asked 2016-05-01 12:28:57 -0600

spmaniato gravatar image

I want to use rosbridge on Mac OS X, which depends on rosauth, which in turn depends on libssl-dev

I've installed openssl on OS X via Homebrew, but it's keg-only since Apple uses its own libraries. Therefore, compilation of rosauth fails with:

[ 99%] Building CXX object rosauth/CMakeFiles/ros_mac_authentication_test.dir/test/ros_mac_authentication_test.cpp.o
[ 99%] Building CXX object rosauth/CMakeFiles/ros_mac_authentication.dir/src/ros_mac_authentication.cpp.o
/Users/smaniato/Cornell/Research/Projects/behaviors_ws/src/rosauth/src/ros_mac_authentication.cpp:15:10: fatal error: 'openssl/sha.h' file not found
#include <openssl/sha.h>

Homebrew says that I have to manually add the following build variables:

LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

How do I pass those to catkin_make? I tried the following but it didn't work:

catkin_make -D LDFLAGS=-L/usr/local/opt/openssl/lib CPPFLAGS=-I/usr/local/opt/openssl/include

I'm also OK with modifying CMakeLists.txt, since I'm building from source. Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-02 02:04:54 -0600

mgruhler gravatar image

I don't know how to pass this via command line.

If you want to adapt the CMakeLists.txt, you should be able to add the respective directories easily:


make sure to add them before you create the respective targets.

However, imho it would be better to let this be handled by find_package, but I don't know if and how this works in OS X...

edit flag offensive delete link more


Thanks! I'll try adding those directories to CMakeLists.txt later today. I'll get back to you :-)

spmaniato gravatar image spmaniato  ( 2016-05-02 12:06:20 -0600 )edit

Yep, it worked. I'll mark your answer as correct :-)

spmaniato gravatar image spmaniato  ( 2016-05-03 19:06:40 -0600 )edit

Question Tools

1 follower


Asked: 2016-05-01 12:28:57 -0600

Seen: 1,721 times

Last updated: May 02 '16