diff --git a/CMakeLists.txt b/CMakeLists.txt index 51c42add3..5353d7343 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7aba77ee..845b19639 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)