<div dir="ltr"><div>Hi all,</div><div><br></div><div>I did't found info how cmake internally handles CFLAGS environment variable, but I know that cmake picks it up from environment and seems this removes link directories from linking flags added by link_directories() command.</div>
<div><br></div><div>For example. I'm using custom sysroot, to build my app and I run cmake with following command:</div><div><br></div><div>   export CFLAGS="--sysroot=/sysroot/"</div><div>   cmake ..</div><div>
<br></div><div>My cmake file is:</div><div><br></div><div>   # GStreamer_LIBRARY_DIRS is set by pkg_check_modules()<br></div><div><div>   link_directories(${GStreamer_LIBRARY_DIRS})</div><div><br></div><div>   get_directory_property(LINK_DIRS LINK_DIRECTORIES)</div>
<div>   message("LINK_DIRS: ${LINK_DIRS}")</div><div><br></div><div>   add_executable(myapp main.c)<br></div><div>   target_link_libraries(myapp ${GStreamer_LIBRARIES})</div><div><br></div></div><div>When CFLAGS isn't specified, then file src/CMakeFiles/myapp.dir/link.txt contains -L/sysroot/usr/lib and -Wl,-rpath,/sysroot/usr/lib flags as expected, but when I add CFLAGS to environment, then -L and -Wl,-rpath are disappearing from linker options.</div>
<div><br></div><div>Could someone to confirm, is this expected behavior?<br></div><div><br></div><div><div>PS: Regardless of CFLAGS specified in command line or not, message() always prints: LINK_DIRS: /sysroot/usr/lib, so internally cmake sets this property.</div>
</div><div><br></div>Thanks!<div><br clear="all"><div><div dir="ltr"><div><div>Alexander</div></div></div></div>
</div></div>