Message ID | 20170531210256.2284-1-f.fainelli@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | Florian Fainelli |
Headers | show |
On 05/31/2017 11:02 PM, Florian Fainelli wrote: > Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for > libubox/uloop.h. Some external toolchains which do not include standard > locations would fail to find the header otherwise. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> > --- > upgraded/CMakeLists.txt | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/upgraded/CMakeLists.txt b/upgraded/CMakeLists.txt > index 00d8ce575c25..fd7d6bb58b78 100644 > --- a/upgraded/CMakeLists.txt > +++ b/upgraded/CMakeLists.txt > @@ -1,6 +1,8 @@ > cmake_minimum_required(VERSION 2.6) > > PROJECT(upgraded C) > +FIND_PATH(ubox_include_dir libubox/uloop.h) > +INCLUDE_DIRECTORIES(${ubox_include_dir}) > ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) > ADD_EXECUTABLE(upgraded upgraded.c ../watchdog.c) > TARGET_LINK_LIBRARIES(upgraded ubox) Another option would be to use the CMake module I wrote for my GSoC project last year: https://gitlab.com/neoraider/ece/blob/master/cmake/Findubox.cmake With this, find_package(ubox REQUIRED) can be used to get the include/library definitions, while still allowing to override the values on the cmake cmdline or using ccmake, in case CMake can't find the right paths automatically. The repo also contains reusable CMake modules for ubus and libjson-c. Matthias
On 05/31/2017 02:09 PM, Matthias Schiffer wrote: > On 05/31/2017 11:02 PM, Florian Fainelli wrote: >> Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for >> libubox/uloop.h. Some external toolchains which do not include standard >> locations would fail to find the header otherwise. >> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> >> --- >> upgraded/CMakeLists.txt | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/upgraded/CMakeLists.txt b/upgraded/CMakeLists.txt >> index 00d8ce575c25..fd7d6bb58b78 100644 >> --- a/upgraded/CMakeLists.txt >> +++ b/upgraded/CMakeLists.txt >> @@ -1,6 +1,8 @@ >> cmake_minimum_required(VERSION 2.6) >> >> PROJECT(upgraded C) >> +FIND_PATH(ubox_include_dir libubox/uloop.h) >> +INCLUDE_DIRECTORIES(${ubox_include_dir}) >> ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) >> ADD_EXECUTABLE(upgraded upgraded.c ../watchdog.c) >> TARGET_LINK_LIBRARIES(upgraded ubox) > > Another option would be to use the CMake module I wrote for my GSoC project > last year: > > https://gitlab.com/neoraider/ece/blob/master/cmake/Findubox.cmake > > With this, find_package(ubox REQUIRED) can be used to get the > include/library definitions, while still allowing to override the values on > the cmake cmdline or using ccmake, in case CMake can't find the right paths > automatically. > > The repo also contains reusable CMake modules for ubus and libjson-c. I have to admit that I am not familiar enough with CMake modules to make up something useful yet, why don't we apply my patch and we look into incorporating your module in OpenWrt/LEDE's CMake infrastructure next? Thanks!
On 05/31/2017 02:02 PM, Florian Fainelli wrote: > Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for > libubox/uloop.h. Some external toolchains which do not include standard > locations would fail to find the header otherwise. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Applied, I will follow-up on the modules you wrote Matthias, thanks!
diff --git a/upgraded/CMakeLists.txt b/upgraded/CMakeLists.txt index 00d8ce575c25..fd7d6bb58b78 100644 --- a/upgraded/CMakeLists.txt +++ b/upgraded/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.6) PROJECT(upgraded C) +FIND_PATH(ubox_include_dir libubox/uloop.h) +INCLUDE_DIRECTORIES(${ubox_include_dir}) ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) ADD_EXECUTABLE(upgraded upgraded.c ../watchdog.c) TARGET_LINK_LIBRARIES(upgraded ubox)
Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for libubox/uloop.h. Some external toolchains which do not include standard locations would fail to find the header otherwise. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- upgraded/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+)