Skip to content
Snippets Groups Projects
Commit b1c6d3e4 authored by tobiglaser's avatar tobiglaser
Browse files

added CMakeLists for Template export

parent 75e39606
No related merge requests found
cmake_minimum_required(VERSION 3.18)
project(CuteProject VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(MY_TARGET "cybersolution")
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" ${CMAKE_FIND_LIBRARY_PREFIXES})
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -static-libgcc -static-libstdc++")
aux_source_directory(src SOURCES)
add_executable(${MY_TARGET}
lib/main.cpp
${SOURCES}
)
target_include_directories(${MY_TARGET} PRIVATE
lib
)
target_link_directories(${MY_TARGET} PRIVATE
lib
)
target_link_libraries(${MY_TARGET} PRIVATE
cute
)
# Set the WIN32_EXECUTABLE property conditionally for Release, MinSizeRel, and RelWithDebInfo builds.
# This lets the exe run without a terminal, making stdout inaccessible for now.
if(WIN32)
set_target_properties(${MY_TARGET} PROPERTIES WIN32_EXECUTABLE $<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>,$<CONFIG:RelWithDebInfo>>)
endif(WIN32)
# Use this command to copy the .dll from the lib folder next to the freshly built .exe. Which is the most simple way to get it working.
add_custom_command(TARGET ${MY_TARGET} POST_BUILD # Adds a post-build event to DynamicDemo
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..."
"${PROJECT_SOURCE_DIR}/lib/cute.dll" # <--this is in-file
$<TARGET_FILE_DIR:${MY_TARGET}>) # <--this is out-file path
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment