I have done some simple CMAKE files on small projects. This project was thrown in to my hands and i am trying to make a simple CMAKE file (for scalability). It comes with 2 .cc files (mains) and 3 folders (CLASSES, HANDLERS and INCLUDE). INCLUDE has all the header files (both .h and .hh). I am trying to wrap this up (reading CMAKE documentation and examples) but could not answer this question.
My CMAKE:
cmake_minimum_required(VERSION 3.2)
project(deti_boot_fbp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SRC "AuthenticatedFileBroadcast/src") set(CLASSES "AuthenticatedFileBroadcast/src/classes") set(HANDLERS "AuthenticatedFileBroadcast/src/handlers") set(INCLUDE "AuthenticatedFileBroadcast/src/include") set(SOURCE_FILES_CLIENT ${SRC}/fbp-client.cc)
file(GLOB SOURCE_FILES RELATIVE "${CLASSES}" ".{cc,cpp}" "${HANDLERS}" ".{cc,cpp}" "${INCLUDE}" "*.{hh,h}")
INCLUDE_DIRECTORIES (${SRC} ${CLASSES} ${HANDLERS} ${INCLUDE} )
add_library(deti_boot_lib SHARED ${SOURCE_FILES}) SET_TARGET_PROPERTIES(deti_boot_lib PROPERTIES LINKER_LANGUAGE CXX)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/binn) set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
add_executable( deti_boot_fbp ${SOURCE_FILES_CLIENT})
target_link_libraries( deti_boot_fbp deti_boot_lib) target_link_libraries( deti_boot_fbp crypto pthread z dl)
The final result is that the main (fbp-client) is not linked to my own methods (deti_boot_lib)
Aucun commentaire:
Enregistrer un commentaire