Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CMake Functions work with 'catkin_make' but fail with 'catkin build

I have two catkin packages. One package will be called 'function_maker' and the other is 'function_user'. Here are my two CMakeLists.txt:

function_maker CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(function_maker)
add_compile_options(-std=c++11 -g)

find_package(catkin REQUIRED)

catkin_package()

function(test_func arg)
    message("Function Called")
endfunction()

function_user CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(function_user)
add_compile_options(-std=c++11 -g)

find_package(catkin REQUIRED
    COMPONENETS
        function_maker
)

catkin_package()

test_func()

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

Unknown CMake command "test_func".

Why is there a difference between 'catkin_make' and 'catkin build'? How can I make this work with both build tools?

CMake Functions work with 'catkin_make' but fail with 'catkin build

I have two catkin packages. One package will be called 'function_maker' and the other is 'function_user'. Here are my two CMakeLists.txt:

function_maker CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(function_maker)
add_compile_options(-std=c++11 -g)

find_package(catkin REQUIRED)

catkin_package()

function(test_func arg)
    message("Function Called")
endfunction()

function_user CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(function_user)
add_compile_options(-std=c++11 -g)

find_package(catkin REQUIRED
    COMPONENETS
COMPONENTS
        function_maker
)

catkin_package()

test_func()

When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".

However, when I use 'catkin build' to build my workspace, I get the following error message:

Unknown CMake command "test_func".

Why is there a difference between 'catkin_make' and 'catkin build'? How can I make this work with both build tools?