一个DLL将它们全部整合在一起 - CMAKE,

时间:2017-01-18 08:41:00

标签: dll plugins cmake

我偶然发现了一个问题..我想从以下位置创建一个库:

  • 3 hpp(2 class.hpp,1 main.hpp)
  • 3 cpp(2 class.cpp,1 main.hpp)

图书馆应该有#34; .xpl"作为结束(Xplane10插件)并依赖于ROS,STD和我自己的数学库,我都链接到.xpl 我刚接触到CMake和软件设计。我只是试图改变一个创建.exec的工作cmake

" if(NOT("" STREQUAL" $ {MODULE_HEADERS}" OR"" STREQUAL" $ {MODULE_SOURCES} &#34))

foreach(plugin ${MODULE_PLUGIN_SOURCES} ${MODULE_HEADERS})
get_filename_component(CPP ${plugin} NAME_WE)
set(PLUGIN_NAME "${MODULE_NAME}_${CPP}")
add_library(${PLUGIN_NAME} SHARED ${MODULE_SOURCES} ${HEADER_MOC} ${plugin})

target_link_libraries(${PLUGIN_NAME} ${MODULE_LIBRARIES})
if(NOT ("" STREQUAL "${MODULE_DEPENDENCIES}"))
add_dependencies     (${PLUGIN_NAME} ${MODULE_DEPENDENCIES})
else ()
message("no dependencies.. Are you sure? ")
endif(NOT ("" STREQUAL "${MODULE_DEPENDENCIES}"))

SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX "")
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS 

"${CMAKE_SHARED_LINKER_FLAGS} ${XPLANE_LINKER_FLAGS}")
set_target_properties(${PLUGIN_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${XPLANE_PLUGIN_DIR}" )
set_target_properties(${PLUGIN_NAME} PROPERTIES 
LIBRARY_OUTPUT_DIRECTORY "${XPLANE_PLUGIN_DIR}" )
set_target_properties(${PLUGIN_NAME} PROPERTIES OUTPUT_NAME "${PLUGIN_OUTPUT_FILENAME}")
endforeach()

else(NOT ("" STREQUAL "${MODULE_HEADERS}" OR "" STREQUAL "${MODULE_SOURCES}"))
message("${MODULE_NAME}: No source files  available: Plugin will NOT be created!\n" FATAL_ERROR)
endif(NOT ("" STREQUAL "${MODULE_HEADERS}" OR "" STREQUAL "${MODULE_SOURCES}"))

链接到另一个论坛,我问了一个类似的问题: http://forums.x-plane.org/index.php?/forums/topic/113887-compile-linux-with-classes-and-cmake/#comment-1109097

0 个答案:

没有答案