OROCOS_TARGET doesn't check if the target is available

Hi,

I think that it's a bug, but I would like to ask if someone of you have
experienced this behavior.

Let we have an standard orocos-toolchain installation with only one target
(gnulinux).

Lets we have a components (generator) and set in its CMakeLists ->
OROCOS_TARGET as xenomai

set(OROCOS_TARGET xenomai)

We call the cmake and it does his job:

cmake ../

OROCOS_TARGET doesn't check if the target is available

On Mon, May 27, 2013 at 11:46 AM, Leopold Palomo-Avellaneda
<leopold [dot] palomo [..] ...> wrote:
> Hi,
>
> I think that it's a bug, but I would like to ask if someone of you have
> experienced this behavior.
>
> Let we have an standard orocos-toolchain installation with only one target
> (gnulinux).
>
> Lets we have a components (generator) and set in its CMakeLists ->
> OROCOS_TARGET as xenomai
>
> set(OROCOS_TARGET xenomai)
>
> We call the cmake and it does his job:
>
> cmake ../

OROCOS_TARGET doesn't check if the target is available

A Dilluns, 27 de maig de 2013, Peter Soetens va escriure:
> On Mon, May 27, 2013 at 11:46 AM, Leopold Palomo-Avellaneda
>
> <leopold [dot] palomo [..] ...> wrote:
> > Hi,
> >
> > I think that it's a bug, but I would like to ask if someone of you have
> > experienced this behavior.
> >
> > Let we have an standard orocos-toolchain installation with only one
> > target (gnulinux).
> >
> > Lets we have a components (generator) and set in its CMakeLists ->
> > OROCOS_TARGET as xenomai
> >
> > set(OROCOS_TARGET xenomai)
> >
> > We call the cmake and it does his job:
> > cmake ../
> >
> > -- The C compiler identification is GNU 4.7.2
> > -- The CXX compiler identification is GNU 4.7.2
> > -- Check for working C compiler: /usr/bin/gcc
> > -- Check for working C compiler: /usr/bin/gcc -- works
> > -- Detecting C compiler ABI info
> > -- Detecting C compiler ABI info - done
> > -- Check for working CXX compiler: /usr/bin/c++
> > -- Check for working CXX compiler: /usr/bin/c++ -- works
> > -- Detecting CXX compiler ABI info
> > -- Detecting CXX compiler ABI info - done
> > Detected OROCOS_TARGET environment variable. Using: gnulinux
>
> The environment variable overrides the cmake variable... use:
>
> cd build
> OROCOS_TARGET=xenomai cmake ..
>
> to configure for Xenomai. I need the full cmake file to see if there
> is any other confusion going on...

I can send it, no problem. It's from the template but i think that i have not
been clear. If I put in the CMakeLists.txt

set(OROCOS_TARGET xenomai)

and xenomai target is NOT installed/build/configured, whatever, it's not
convenient to create a component with name libgenerator-xenomai.so when the
xenomai target doesn't exists, because it could give confusion.

So, the macro orocos_component should test if the target exists . That's all.
Or, make a message talling something.

Leo
----------------------------------------
CMakeLists.txt
----------------------------------------
#
# The find_package macro for Orocos-RTT works best with
# cmake >= 2.6.3
#
cmake_minimum_required(VERSION 2.6.3)

#
# This creates a standard cmake project. You may extend this file with
# any cmake macro you see fit.
#
project(generator)

#
# Do setup in case of ros package, If ROS_ROOT is set, it is
# recommended to use RTT/OCL through the ros packages.
#
set (ROS_ROOT $ENV{ROS_ROOT} )
if (ROS_ROOT)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
rosbuild_find_ros_package( rtt )
set( RTT_HINTS HINTS ${rtt_PACKAGE_PATH}/install )
endif()

# Set the CMAKE_PREFIX_PATH in case you're not using Orocos through ROS
# for helping these find commands find RTT.
find_package(OROCOS-RTT REQUIRED ${RTT_HINTS})

# Defines the orocos_* cmake macros. See that file for additional
# documentation.
include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake)

#
# Components, types and plugins.
#
# The CMake 'target' names are identical to the first argument of the
# macros below, except for orocos_typegen_headers, where the target is fully
# controlled by generated code of 'typegen'.
#
set(OROCOS_TARGET xenomai)
# Creates a component library libgenerator-<target>.so
# and installs in the directory lib/orocos/generator/
#
orocos_component(generator generator.hpp generator.cpp) # ...you may add
multiple source files
#
# You may add multiple orocos_component statements.

#
# Additional headers:
#
# Installs in the include/orocos/generator/ directory
#
orocos_install_headers( generator.hpp ) # ...you may add multiple header files
#
# You may add multiple orocos_install_headers statements.

#
# Generates and installs our package. Must be the last statement such
# that it can pick up all above settings.
#
orocos_generate_package()