OpenWrt Forum Archive

Topic: CMAKE OpenWRT SYSTEM check?

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Is there a proper way to check whether a build is done for OpenWRT in CMake?

We want to compile a package on multiple platforms (OpenWRT, OS X, Linux) and for OpenWRT specifically we have a dependency on uci.

We where hoping that there would be a CMake variable that we could use to determine whether where building for OpenWRT, but we can't find one.
CMake variables: http://www.cmake.org/Wiki/CMake_Useful_Variables

The place where most general OpenWRT variables seem to be set:
http://git.openwrt.org/?p=14.07/openwrt … 670107#l39

Out best hack at the moment is using:
if(CMAKE_SYSTEMNAME STREQUAL Linux AND CMAKE_CROSSCOMPILING)
endif

A way to check wheter uci was enables would also work, but a general openwrt check would still be nice.

You can override Package/compile step and set your variables from there.

But, isn't it weird that there isn't such a variable already set by the OpenWRT buildroot?

The discussion might have continued from here.