mercredi 24 mai 2017

How to merge two separate c++ code files with make files

I have two different source code files File A.cpp with CMakeLists.txt and File B.cpp with Makefile. for e.g;

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)       
project(A)
find_package(PCL 1.7 REQUIRED) ..... 

and Makefile as below`

OS_NAME ?=$(shell uname)                                                  
LIBS = -lpthread                                                      
LIB_NAME = AdsLib-$(OS_NAME).a                                        
CXXFLAGS += -std=c++11                                                
CXXFLAGS += -pedantic                                                 
CXXFLAGS += -Wall                                                            
CXXFLAGS += $(ci_cxx_flags) ifeq ($(OS_NAME),win32)
    LIBS += -lws2_32                       endif                          
    all: example.bin                                                      example.bin: $(LIB_NAME) example.cpp
$(CXX) example.cpp $< $(LIBS) $(CXXFLAGS) -o $@                          
  test: example.bin
./$<                                                                               
 clean:
rm -f *.o *.bin

Goal is to merge the two source code files A.cpp and B.cpp together or lets say to bring the functionality of B.cpp into A.cpp. In order to do that I am looking a relaible way to merge these Make files. Any suggestions ?

Aucun commentaire:

Enregistrer un commentaire