Skip to content

Commit a2a7c4e

Browse files
committed
IDE generator is now prettier (and generic)
1 parent b4b5cf4 commit a2a7c4e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ cmake_minimum_required(VERSION 3.0)
33
project(task-opt1)
44

55
if (MSVC)
6+
# We build Relase with the /MD (DLL) option instead of CMake's default /MT (static runtime)
67
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /wd4576 /D_HAS_EXCEPTIONS=0 /GR- /MP")
7-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /D_DEBUG=1 /wd4189")
8-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ot /Oi /GS- /Gy /DNDEBUG=1 /GL")
8+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /MDd /wd4189")
9+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ot /Oi /MD /GS- /Gy /DNDEBUG=1 /GL")
910
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /OPT:ICF /INCREMENTAL:NO /LTCG")
1011
else()
1112
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-exceptions -fno-rtti")
@@ -17,6 +18,9 @@ else()
1718
endif()
1819
endif()
1920

20-
add_executable(task-opt1 "${CMAKE_CURRENT_LIST_DIR}/main.cpp")
21+
file(GLOB INCS "*.h" "*.inc")
22+
file(GLOB SRCS "*.cpp")
23+
source_group("Headers" FILES ${INCS})
24+
source_group("Sources" FILES ${SRCS})
2125

22-
target_include_directories(task-opt1 PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
26+
add_executable(task-opt1 ${SRCS} ${INCS})

0 commit comments

Comments
 (0)