Skip to content

Instantly share code, notes, and snippets.

@bhaskar253
Created April 16, 2020 16:51
Show Gist options
  • Select an option

  • Save bhaskar253/8e8e07e9cb3fa465cbca6e55226f9f36 to your computer and use it in GitHub Desktop.

Select an option

Save bhaskar253/8e8e07e9cb3fa465cbca6e55226f9f36 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 2.8.12)
project(YOUR_PROJECT)
# Enable multithreaded compilation in MSVC
if (MSVC)
add_definitions(/MP)
endif()
# Rewrite to a nicer output directory. Can be removed
set(ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output)
set(LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output)
set(RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/output)
# Include Paths
include_directories("${PROJECT_SOURCE_DIR}/include/PATH")
# Add fiiles to src
file(GLOB src
"${PROJECT_SOURCE_DIR}/src/*.h"
"${PROJECT_SOURCE_DIR}/src/*.cpp"
"${PROJECT_SOURCE_DIR}/src/*.c"
"${PROJECT_SOURCE_DIR}/src/ADDITIONAL/PATHS/..."
)
# default flags to true
option(YOUR_PROJECT_EXECUTABLE "BUILD EXECUTABLE" ON)
if (YOUR_PROJECT_EXECUTABLE)
add_executable(your_project ${vm_src})
target_link_libraries(your_project ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${ST_CXXFS_LIBS})
target_include_directories(your_project PUBLIC ${PROJECT_SOURCE_DIR}/src)
endif ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment