title: cmake for OpenDDS Project
body: <p>looking for a standard CMakelist to build OpenDDS application (Simple Publisher/Subscriber). I am familiar with the Tutorials and everything is running fine with MPC to build the examples. I need to build my project with cmake. I m using OpenDDS 3.9.</p>
  
  <p>I tried to make a CMakelist for the Stockquote Example on here:
  <a href="http://opendds.org/about/articles/Article-Intro.html" rel="nofollow noreferrer">http://opendds.org/about/articles/Article-Intro.html</a></p>
  
  <p>My CMakelist looks as follows:</p>
  
  <pre><code>cmake_minimum_required (VERSION 3.3.0)
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  project (publisher)
  set(DDS_ROOT_DIR "home/ubuntu/OpenDDS-3.9")
  
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
  
  include_directories (${DDS_ROOT_DIR} "${DDS_ROOT_DIR}/ACE_wrappers" "${DDS_ROOT_DIR}/ACE_wrappers/TAO" ${CMAKE_SOURCE_DIR})
  
  file (GLOB_RECURSE PUBLISHER_SRC *.cpp)
  file (GLOB_RECURSE IDL_SRC ${CMAKE_SOURCE_DIR} *.cpp)
  
  add_executable (${PROJECT_NAME} ${PUBLISHER_SRC} ${IDL_SRC})
  
  project (subscriber)
  
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
  set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
  
  include_directories (${DDS_ROOT_DIR} "${DDS_ROOT_DIR}/ACE_wrappers" "${DDS_ROOT_DIR}/ACE_wrappers/TAO" ${CMAKE_SOURCE_DIR})
  
  file (GLOB_RECURSE SUBSCRIBER_SRC *.cpp)
  file (GLOB_RECURSE IDL_SRC ${CMAKE_SOURCE_DIR} *.cpp)
  
  add_executable (${PROJECT_NAME} ${SUBSCRIBER_SRC} ${IDL_SRC})
  
  # Adding DDS link_libraries
  if (WIN32)
    file (GLOB OpenDDS_LIBS "${DDS_ROOT_DIR}/lib/*d.dll")
    foreach (i ${OpenDDS_LIBS})
      get_filename_component (BASE_NAME_DLL ${i} NAME_WE)
      add_library (${BASE_NAME_DLL} SHARED IMPORTED)
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_LOCATION "${DDS_ROOT_DIR}/lib/${BASE_NAME_DLL}.dll")
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_IMPLIB "${DDS_ROOT_DIR}/lib/${BASE_NAME_DLL}.lib")
      target_link_libraries (${PROJECT_NAME} ${BASE_NAME_DLL})
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $&lt;TARGET_FILE:${BASE_NAME_DLL}&gt; $&lt;TARGET_FILE_DIR:${PROJECT_NAME}&gt;)
    endforeach()
  
    file (GLOB OpenDDS_LIBS "${DDS_ROOT_DIR}/ACE_wrappers/lib/*d.dll")
    foreach (i ${OpenDDS_LIBS})
      get_filename_component (BASE_NAME_DLL ${i} NAME_WE)
      add_library (${BASE_NAME_DLL} SHARED IMPORTED)
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_LOCATION "${DDS_ROOT_DIR}/ACE_wrappers/lib/${BASE_NAME_DLL}.dll")
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_IMPLIB "${DDS_ROOT_DIR}/ACE_wrappers/lib/${BASE_NAME_DLL}.lib")
      target_link_libraries (${PROJECT_NAME} ${BASE_NAME_DLL})
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $&lt;TARGET_FILE:${BASE_NAME_DLL}&gt; $&lt;TARGET_FILE_DIR:${PROJECT_NAME}&gt;)
    endforeach ()
  elseif (UNIX)
    file (GLOB OpenDDS_LIBS "${DDS_ROOT_DIR}/lib/*.so")
    foreach (i ${OpenDDS_LIBS})
      get_filename_component (BASE_NAME_DLL ${i} NAME_WE)
      add_library (${BASE_NAME_DLL} SHARED IMPORTED)
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_LOCATION "${DDS_ROOT_DIR}/lib/${BASE_NAME_DLL}.so")
      target_link_libraries (${PROJECT_NAME} ${BASE_NAME_DLL})
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $&lt;TARGET_FILE:${BASE_NAME_DLL}&gt; $&lt;TARGET_FILE_DIR:${PROJECT_NAME}&gt;)
    endforeach()
    file (GLOB OpenDDS_LIBS "${DDS_ROOT_DIR}/ACE_wrappers/lib/*.so")
    foreach (i ${OpenDDS_LIBS})
      get_filename_component (BASE_NAME_DLL ${i} NAME_WE)
      add_library (${BASE_NAME_DLL} SHARED IMPORTED)
      set_property (TARGET ${BASE_NAME_DLL} PROPERTY IMPORTED_LOCATION "${DDS_ROOT_DIR}/ACE_wrappers/lib/${BASE_NAME_DLL}.so")
      target_link_libraries (${PROJECT_NAME} ${BASE_NAME_DLL})
      add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $&lt;TARGET_FILE:${BASE_NAME_DLL}&gt; $&lt;TARGET_FILE_DIR:${PROJECT_NAME}&gt;)
    endforeach ()
  endif ()
  </code></pre>
  
  <p>I got the adding DDS Link Libraries Section from the WTeam Blog. <a href="http://www.wteam.it/index.php/articles/the-hla-series/9-article/15-first-opendds-program" rel="nofollow noreferrer">http://www.wteam.it/index.php/articles/the-hla-series/9-article/15-first-opendds-program</a></p>
  
  <p>Currently i receive this error message if i'm using cmake --build:</p>
  
  <blockquote>
    <p>/usr/local/include/dds/DCPS/DataWriterImpl_T.h: In instantiation of ‘void
    OpenDDS::DCPS::DataWriterImpl_T::init(DDS::Topic_ptr,
    OpenDDS::DCPS::TopicImpl*, const DDS::DataWriterQos&amp;,
    DDS::DataWriterListener_ptr, const StatusMask&amp;,
    OpenDDS::DCPS::DomainParticipantImpl*, OpenDDS::DCPS::PublisherImpl*,
    DDS::DataWriter_ptr) [with MessageType = Messenger::Message;
    DDS::Topic_ptr = DDS::Topic*; DDS::DataWriterListener_ptr =
    DDS::DataWriterListener*; DDS::StatusMask = unsigned int;
    DDS::DataWriter_ptr = DDS::DataWriter*]’:
    /usr/local/include/dds/DCPS/FilterEvaluator.h:142:10:   required from
    here /usr/local/include/dds/DCPS/DataWriterImpl_T.h:317:50: error:
    incomplete type
    ‘OpenDDS::DCPS::DataWriterImpl_T::MarshalTraitsType
    {aka OpenDDS::DCPS::MarshalTraits}’ used in nested
    name specifier
           if (MarshalTraitsType::gen_is_bounded_size()) {
                                                      ^ /usr/local/include/dds/DCPS/DataWriterImpl_T.h:323:54: error:
    incomplete type
    ‘OpenDDS::DCPS::DataWriterImpl_T::MarshalTraitsType
    {aka OpenDDS::DCPS::MarshalTraits}’ used in nested
    name specifier
           if (MarshalTraitsType::gen_is_bounded_key_size()) {
                                                          ^ /usr/local/include/dds/DCPS/DataWriterImpl_T.h: In instantiation of
    ‘DDS::ReturnCode_t
    OpenDDS::DCPS::DataWriterImpl_T::enable_specific() [with
    MessageType = Messenger::Message; DDS::ReturnCode_t = int]’:
    /usr/local/include/dds/DCPS/FilterEvaluator.h:142:10:   required from
    here /usr/local/include/dds/DCPS/DataWriterImpl_T.h:338:51: error:
    incomplete type
    ‘OpenDDS::DCPS::DataWriterImpl_T::MarshalTraitsType
    {aka OpenDDS::DCPS::MarshalTraits}’ used in nested
    name specifier
           if (MarshalTraitsType::gen_is_bounded_size ())
                                                       ^</p>
  </blockquote>
  
  <p>Does anyone have an idea whats wrong or has a standard CMake for OpenDDS applications? Thank you very much for any help.</p>
  
  <p>Cheers, 
  Marcel</p>