Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

using cmake for Scxml



  • I've started using scxml with cmake, and it's been challenging since all the examples that I can find are using qmake; lot's of time wasted trying different things drudged up around the Internet.

    Is there some place I should be able to find how to properly build a an scxml application (using cmake) with out looking at random stackoverflow posts?

    Thanks!



  • Since I'm actually using catkin tools on-top of cmake, some of the key things were as follows:

    list(APPEND CMAKE_PREFIX_PATH /opt/ros/$ENV{ROS_DISTRO})
    list(APPEND CMAKE_PREFIX_PATH /opt/Qt5.12.2/5.12.2/gcc_64)

    find_package(Qt5 REQUIRED COMPONENTS
    Core
    Widgets
    Scxml
    )

    #CMAKE_AUTOMOC does not work!!
    qt5_wrap_cpp(SCXML_MOC
    include/ros_scxml_state.h
    include/ros_scxml.h
    )

    target_link_libraries(${PROJECT_NAME}_SM
    ${catkin_LIBRARIES}
    Qt5::Core
    Qt5::Scxml
    Qt5::Widgets
    )


  • Lifetime Qt Champion

    Hi and welcome to the forums.
    qmake is the official tool at least until Qt6 so you have to dig up info regarding
    qmake to cmake yourself as there is only setup info with QCreator
    https://doc.qt.io/qtcreator/creator-project-cmake.html

    so i guess you found
    https://stackoverflow.com/questions/44989571/qt-statemachine-scxml-in-cmake-project-without-pro-file



  • Yes, and it didn't work; I should try it again. There were 1 or 2 more as well that eventually got me to the point of "it looks like it compiled". But then it was time to go.



  • Since I'm actually using catkin tools on-top of cmake, some of the key things were as follows:

    list(APPEND CMAKE_PREFIX_PATH /opt/ros/$ENV{ROS_DISTRO})
    list(APPEND CMAKE_PREFIX_PATH /opt/Qt5.12.2/5.12.2/gcc_64)

    find_package(Qt5 REQUIRED COMPONENTS
    Core
    Widgets
    Scxml
    )

    #CMAKE_AUTOMOC does not work!!
    qt5_wrap_cpp(SCXML_MOC
    include/ros_scxml_state.h
    include/ros_scxml.h
    )

    target_link_libraries(${PROJECT_NAME}_SM
    ${catkin_LIBRARIES}
    Qt5::Core
    Qt5::Scxml
    Qt5::Widgets
    )


Log in to reply