[CMake] Set binary and library output dir to objs on Windows

Without this patch, CMake places output binaries and libraries in
the respective source directories, like the autotools build system.
The Visual Studio build system places objects in the objs directory

Because CTest didn't run properly when building shared libs, this
commit changes the CMake behaviour on (NOT UNIX) to that similar
to Visual Studio. That way, DLLs and EXEs are placed in the same
directory and running CTest with the correct DLLs being loaded
is trivial.
This commit is contained in:
Martijn van Beurden 2022-01-07 14:58:25 +01:00
parent 4256c12eac
commit db72703f86
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,12 @@ option(BUILD_SHARED_LIBS "Build shared instead of static libraries" OFF)
set(VERSION ${PROJECT_VERSION})
if(NOT UNIX)
# This is to make sure testing works when building with a DLL
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/objs)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/objs)
endif()
if(WITH_OGG)
find_package(Ogg REQUIRED)
set(OGG_PACKAGE "ogg")