Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Package that contains packageConfig.cmake only

We have a whole bunch of packages with CMakeLists,txt that share code like

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(project_cxx_flags -Wall)
set(project_cuda_flags -gencode arch=compute_61,code=compute61 -gencode ..62 -gencode ..52)

Along with other code for doing stuff on either x64 or arm64 (we also should only build CUDA 6.2 on ARM, 5.2 on x64, etc) that really should be made common.

Reading the documentation for find_package() it seems it should be possible to create a new package inside our main project and then use:

find_package(common_stuff)

To load up common_stuffConfig.cmake. My current directory structure looks like

catkin_root\src
+--foo
    +--various files...
+--bar
    +--various files...
+--common_stuff
    +--CmakeLists.txt (empty file)
    +--Findcommon_stuff.cmake
    +--package.xml
    +--common_stuffConfig.cmake

So, currently I do this:

find_package(catkin REQUIRED COMPONENTS
    ...
    common_stuff)
find_package(common_stuff REQUIRED MODULE)
# or
find_package(common_stuff REQUIRED)

This runs without error, but even though I have put logging messages in the two common_stuff .cmake files, nothing ever gets printed. What am I missing? I've tried with both catkin_make and catkin build.

Package that contains packageConfig.cmake only

We have a whole bunch of packages with CMakeLists,txt that share code like

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(project_cxx_flags -Wall)
set(project_cuda_flags -gencode arch=compute_61,code=compute61 -gencode ..62 -gencode ..52)

Along with other code for doing stuff on either x64 or arm64 (we also should only build CUDA 6.2 on ARM, 5.2 on x64, etc) that really should be made common.

Reading the documentation for find_package() it seems it should be possible to create a new package inside our main project and then use:

find_package(common_stuff)

To load up common_stuffConfig.cmake. .

NOTE: I know I could use CMAKE_MODULE_PATH but I would have to reconfigure a good number of machines, so I want a solution that uses the existing code tree.

My current directory structure looks like

catkin_root\src
+--foo
    +--various files...
+--bar
    +--various files...
+--common_stuff
    +--CmakeLists.txt (empty file)
    +--Findcommon_stuff.cmake
    +--package.xml
    +--common_stuffConfig.cmake

So, currently I do this:

find_package(catkin REQUIRED COMPONENTS
    ...
    common_stuff)
find_package(common_stuff REQUIRED MODULE)
# or
find_package(common_stuff REQUIRED)

This runs without error, but even though I have put logging messages in the two common_stuff .cmake files, nothing ever gets printed. What am I missing? I've tried with both catkin_make and catkin build.

Package that contains packageConfig.cmake only

We have a whole bunch of packages with CMakeLists,txt that share code like

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(project_cxx_flags -Wall)
set(project_cuda_flags -gencode arch=compute_61,code=compute61 -gencode ..62 -gencode ..52)

Along with other code for doing stuff on either x64 or arm64 (we also should only build CUDA 6.2 on ARM, 5.2 on x64, etc) that really should be made common.

Reading the documentation for find_package() it seems it should be possible to create a new package inside our main project and then use:

find_package(common_stuff)

To load up common_stuffConfig.cmake.

NOTE: I know I could use CMAKE_MODULE_PATH but I would have to reconfigure a good number of machines, so I want a solution that uses the existing code tree.

My current directory structure looks like

catkin_root\src
+--foo
    +--various files...
+--bar
    +--various files...
+--common_stuff
    +--CmakeLists.txt (empty file)
    +--Findcommon_stuff.cmake
    +--package.xml
    +--common_stuffConfig.cmake

So, currently I do this:

find_package(catkin REQUIRED COMPONENTS
    ...
    common_stuff)
find_package(common_stuff REQUIRED MODULE)
# or
find_package(common_stuff REQUIRED)

This runs without error, but even though I have put logging messages fails with the error:

No "Findcommon_stuff_build.cmake" found in the two common_stuff .cmake files, nothing ever gets printed. What am I missing? I've tried with both catkin_make and catkin build.

CMAKE_MODULE_PATH.

Package that contains packageConfig.cmake only

We have a whole bunch of packages with CMakeLists,txt that share code like

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(project_cxx_flags -Wall)
set(project_cuda_flags -gencode arch=compute_61,code=compute61 -gencode ..62 -gencode ..52)

Along with other code for doing stuff on either x64 or arm64 (we also should only build CUDA 6.2 on ARM, 5.2 on x64, etc) that really should be made common.

Reading the documentation for find_package() it seems it should be possible to create a new package inside our main project and then use:

find_package(common_stuff)

To load up common_stuffConfig.cmake.

NOTE: I know I could use CMAKE_MODULE_PATH but I would have to reconfigure a good number of machines, so I want a solution that uses the existing code tree.

My current directory structure looks like

catkin_root\src
+--foo
    +--various files...
+--bar
    +--various files...
+--common_stuff
    +--CmakeLists.txt (empty file)
    +--Findcommon_stuff.cmake
    +--package.xml
    +--common_stuffConfig.cmake

So, currently I do this:

find_package(catkin REQUIRED COMPONENTS
    ...
    common_stuff)
find_package(common_stuff REQUIRED MODULE)
# or
find_package(common_stuff REQUIRED)

This fails with the error:

No "Findcommon_stuff_build.cmake" found in CMAKE_MODULE_PATH.

Package that contains packageConfig.cmake only

We have a whole bunch of packages with CMakeLists,txtCMakeLists.txt that share code like

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(project_cxx_flags -Wall)
set(project_cuda_flags -gencode arch=compute_61,code=compute61 -gencode ..62 -gencode ..52)

Along with other code for doing stuff on either x64 or arm64 (we also should only build CUDA 6.2 on ARM, 5.2 on x64, etc) that really should be made common.

Reading the documentation for find_package() it seems it should be possible to create a new package inside our main project and then use:

find_package(common_stuff)

To load up common_stuffConfig.cmake.

NOTE: I know I could use CMAKE_MODULE_PATH but I would have to reconfigure a good number of machines, so I want a solution that uses the existing code tree.

My current directory structure looks like

catkin_root\src
+--foo
    +--various files...
+--bar
    +--various files...
+--common_stuff
    +--CmakeLists.txt (empty file)
    +--Findcommon_stuff.cmake
    +--package.xml
    +--common_stuffConfig.cmake

So, currently I do this:

find_package(common_stuff REQUIRED MODULE)
# or
find_package(common_stuff REQUIRED)

This fails with the error:

No "Findcommon_stuff_build.cmake" found in CMAKE_MODULE_PATH.