cmake_minimum_required(VERSION 3.0) # name the project/executable project(raycasting) # some checks to determine the compiler capabilities, don't worry about this include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() # define the location of the current directory as '${ROOT}' set(ROOT "${CMAKE_CURRENT_SOURCE_DIR}") # define the paths to the cpp files set(SRCFILES ${ROOT}/src/first_hit.cpp ${ROOT}/src/Plane.cpp ${ROOT}/src/Sphere.cpp ${ROOT}/src/Triangle.cpp ${ROOT}/src/TriangleSoup.cpp ${ROOT}/src/viewing_ray.cpp ${ROOT}/main.cpp ) # pass the SRCFILES files to be included during compilation add_executable(${PROJECT_NAME} ${SRCFILES}) # the 'include' and 'eigen' folders contain files that also need to be included in the project include_directories(${ROOT}/include ${ROOT}/eigen) # if using Visual Studio, set the startup project (because it's sadly not smart enough to do this by itself) if(MSVC) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) endif()