cmake_minimum_required(VERSION 3.0) project(cpp-main) # setting the needed compile flags set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") # append the cmake search path to include the cmake-files to help build the # project in lib/GraphLib/cmake_modules set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/GraphLib/cmake_modules" ) # these two lines sets the variables starting with MathGL and FLTK used by # add_executable and include_directories. find_package(MathGL REQUIRED) find_package(FLTK REQUIRED) # these two lines turn off building of tests and examples of the GraphLib # library building of tests and examples is rarely done while developing. See # ./lib/GraphLib/CMakeLists.txt:L23 to see how these affect the library. set(BUILD_EXAMPLES off) set(ENABLE_TESTING off) # this line includes the library GraphLib in lib/GraphLib add_subdirectory("./lib/GraphLib") include_directories( ${MathGL_INCLUDE_DIRS} ${FLTK_INCLUDE_DIR} # The following line might also be ${PROJECT_SOURCE_DIR}/lib/GraphLib/graphlib # If your examples say #include you keep the next value as is. # If your examples is #include you change it to how its mentioned before. ${PROJECT_SOURCE_DIR}/lib/GraphLib ) add_executable(cpp-main main.cpp ${MATHGL_LIBRARIES} ${FLTK_LIBRARIES}) # final notes