Skip to content

Commit

Permalink
Cmake : Fix build in MSYS2 MINGW64 environment
Browse files Browse the repository at this point in the history
  • Loading branch information
cozycactus committed Nov 16, 2023
1 parent d9b0372 commit 51ee783
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-Wdouble-promotion)
add_definitions(-Wno-unused-parameter)
add_definitions(-Wsign-compare)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wdouble-promotion)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wsign-compare)
endif()

if(MSVC)
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ endif()

#build a win32 app, not a console app
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "/entry:mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")
if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS "/entry:mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")
else()
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-e,mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")
endif(MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE ON)
endif (WIN32)

Expand Down

0 comments on commit 51ee783

Please sign in to comment.