if(NOT CMAKE_BUILD_TYPE)
	set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

set(ARCHIVE_OUTPUT_DIRECTORIES
    CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG
    CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE
    CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO
    CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL
)

foreach(DIR ${ARCHIVE_OUTPUT_DIRECTORIES})
    set(${DIR} ${CMAKE_SOURCE_DIR}/lib)
endforeach()

set(LIBRARY_OUTPUT_DIRECTORIES
    CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG
    CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE
    CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO
    CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL
)

foreach(DIR ${LIBRARY_OUTPUT_DIRECTORIES})
    set(${DIR} ${CMAKE_SOURCE_DIR}/bin)
endforeach()

set(RUNTIME_OUTPUT_DIRECTORIES
    CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG
    CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE
    CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
    CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL
)

foreach(DIR ${RUNTIME_OUTPUT_DIRECTORIES})
    set(${DIR} ${CMAKE_SOURCE_DIR}/bin)
endforeach()

if(NOT CMAKE_DEBUG_POSTFIX)
  set(CMAKE_DEBUG_POSTFIX "_d")
endif()

#if(MSVC)
#    set(COMPILER_FLAGS
#        CMAKE_CXX_FLAGS
#        CMAKE_CXX_FLAGS_DEBUG
#        CMAKE_CXX_FLAGS_RELEASE
#        CMAKE_C_FLAGS
#        CMAKE_C_FLAGS_DEBUG
#        CMAKE_C_FLAGS_RELEASE
#    )
#    foreach(COMPILER_FLAG ${COMPILER_FLAGS})
#        string(REPLACE "/MD" "/MT" ${COMPILER_FLAG} "${${COMPILER_FLAG}}")
#    endforeach()
#endif()
