Home | Tutorials | Wiki | Issues
Ask Your Question

'CMAKE_SOURCE_DIR’ was not declared in this scope

asked 2016-05-13 06:55:33 -0500

Rodrigo gravatar image

Hi, I'm trying to compile gazebo but I get the following error:

[ 85%] Building CXX object test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/model_editor_undo.cc.o
/home/user/source/gazebo/test/integration/model_editor_undo.cc: In member function ‘void ModelEditorUndoTest::NestedModelInsertionByMouse()’:
/home/user/source/gazebo/test/integration/model_editor_undo.cc:249:7: error: ‘CMAKE_SOURCE_DIR’ was not declared in this scope
   CMAKE_SOURCE_DIR "/test/models/testdb");
/home/user/source/gazebo/test/integration/model_editor_undo.cc: In member function ‘void ModelEditorUndoTest::JointInsertionByDialog()’:
/home/user/source/gazebo/test/integration/model_editor_undo.cc:461:7: error: ‘CMAKE_SOURCE_DIR’ was not declared in this scope
   CMAKE_SOURCE_DIR "/test/models/testdb");
test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/build.make:120: recipe for target 'test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/model_editor_undo.cc.o' failed
make[2]: *** [test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/model_editor_undo.cc.o] Error 1
CMakeFiles/Makefile2:10323: recipe for target 'test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/all' failed
make[1]: *** [test/integration/CMakeFiles/INTEGRATION_model_editor_undo.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

Any idea what may be causing it?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-05-13 11:03:21 -0500

chapulina gravatar image

It looks like the problem was introduced in this pull request. Some possible ways to fix it:

  • Clean your build directory and build again from scratch

  • Disable tests compilation, with cmake ../ -DENABLE_TESTS_COMPILATION:BOOL=False

  • Build the latest stable release branch, gazebo7 (do hg up gazebo7)

edit flag offensive delete link more


I can successfully build it without tests, still I was wondering what was wrong with the default compilations. Thank you for your input on the issue.

Rodrigo gravatar imageRodrigo ( 2016-05-13 12:37:50 -0500 )edit

This shouldn't be happening, disabling the tests is just a temporary workaround. What platform are you in?

chapulina gravatar imagechapulina ( 2016-05-13 12:44:04 -0500 )edit

I'm on archlinux x64, gcc 6.1.1. That gcc version gave me a lot of trouble, so it may be related (e.g, I had to recompile boost with that version in order for it to link with sdformat).

Rodrigo gravatar imageRodrigo ( 2016-05-13 13:02:26 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-05-13 06:55:33 -0500

Seen: 303 times

Last updated: May 13 '16