c++ - Include another CMake Project as Library -
i have decided make c++-qt-gui c program (both languages don’t know), using kdevelop, in turn uses cmake.
the c source has no header, made one, , migrated structs it, declaration of function in c source need call.
the problem can’t call it, because either cmake doesn’t find c file (and hence definition), or, when add c source source set in cmakelists.txt, complains both main.cpp , c source file have main functions.
how tell cmake should make function c file available declared in header?
here it:
project(oregengui) cmake_minimum_required(version 2.6) find_package(qt4 required) include_directories(${qt_includes} ${cmake_current_binary_dir}) set(oregengui_srcs oregengui.cpp main.cpp qrangeslider/qrangeslider.cpp) #as add oregengui/oregengui.c, won’t work because of main function qt4_automoc(${oregengui_srcs}) add_executable(oregengui ${oregengui_srcs}) target_link_libraries(oregengui ${qt_qtcore_library} ${qt_qtgui_library})
ps: don’t want change c source much, since independant project. guess developer accept introduction of header, not more.
i'm bit rusty on this, along lines of:
in oregengui.c
#if !defined myguiproj int main() { ... } #endif
in cmakelists want both in:
add_definitions( -dmyguiproj )
the compiler should ignore second main function.
Comments
Post a Comment