Skip to content

Instantly share code, notes, and snippets.

@mlcollard
Created October 11, 2021 12:15
Show Gist options
  • Save mlcollard/818623508b8c74634678c22132bced42 to your computer and use it in GitHub Desktop.
Save mlcollard/818623508b8c74634678c22132bced42 to your computer and use it in GitHub Desktop.
CMake file for srcComplexity
# @file CMakeLists.txt
#
# CMake files for the srccomplexity program
cmake_minimum_required(VERSION 3.20)
# project info
project(srcComplexity)
find_package(LibXml2 REQUIRED)
# C++17
set(CMAKE_CXX_STANDARD 17)
# Turn on warnings
if (MSVC)
# warning level 4
add_compile_options(/W4)
else()
# standard warnings
add_compile_options(-Wall)
endif()
# srcomplexity program
add_executable(srccomplexity srcComplexity.cpp srcMLXPathCount.cpp)
target_include_directories(srccomplexity SYSTEM PRIVATE ${LIBXML2_INCLUDE_DIRS})
target_link_libraries(srccomplexity PRIVATE ${LIBXML2_LIBRARIES})
# run command
add_custom_target(run ${CMAKE_BINARY_DIR}/srccomplexity ${CMAKE_SOURCE_DIR}/srcMLXPathCount.cpp.xml)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment