I have the following CMakeLists file which builds one of the examples in FLTK as a separate project.

---
cmake_minimum_required(VERSION 2.6)

project(CubeView)

set(FLTK_DIR /home/msurette/build/fltk-release/)

find_package(FLTK REQUIRED NO_MODULE)
include(${FLTK_USE_FILE})

#run fluid -c to generate cxx and h files
add_custom_command(
        OUTPUT "CubeViewUI.cxx" "CubeViewUI.h"
        COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/CubeViewUI.fl
)

include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
add_executable(CubeView WIN32 CubeMain.cxx  CubeView.cxx  CubeViewUI.cxx)

target_link_libraries(CubeView fltk fltk_gl)
---

It works well, but not without the two include_directories commands.

Could someone please explain to me why they are necessary,

Seeing as the custom command deposits its results in CMAKE_BINARY_DIR I would expect it to be searched for source and header files.

CMAKE_SOURCE_DIR should always be searched for source and header files, shouldn't it?

Mike

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to