orocos / orocos_kinematics_dynamics

Orocos Kinematics and Dynamics C++ library
671 stars 407 forks source link

CMake error of SET(KDL_CFLAGS "${KDL_CFLAGS} -I${EIGEN3_INCLUDE_DIR}") #439

Closed felixf4xu closed 11 months ago

felixf4xu commented 1 year ago

Hi,

I found a potential bug of the cmake file https://github.com/orocos/orocos_kinematics_dynamics/blob/master/orocos_kdl/CMakeLists.txt#L57

SET(KDL_CFLAGS "${KDL_CFLAGS} -I${EIGEN3_INCLUDE_DIR}")

in cmake, SET() will treat white spaces as separator like ;, in my case , ${EIGEN3_INCLUDE_DIR} is C:/Program Files/Eigen3/include/eigen3 which has white space inside.

As a result, when KDL_CFLAGS is used later at COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS}", the result of generated VS project file is like:

      <AdditionalIncludeDirectories>C:\Program Files\Eigen3\include\eigen3;E:\github\orocos_kinematics_dynamics\orocos_kdl\build\src;C:\Program;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <AdditionalOptions>%(AdditionalOptions) Files/Eigen3/include/eigen3</AdditionalOptions>

You can see the path is divided into 2 elements.

As a workaround, I changed the code to

SET(KDL_CFLAGS "${KDL_CFLAGS} -I\"${EIGEN3_INCLUDE_DIR}\"")

and it's fixed.

MatthijsBurgh commented 1 year ago

Thanks for reporting this bug.

Can we use single quotes instead of \"?

felixf4xu commented 1 year ago

I tested, ' or " does not work.