summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2022-01-07 14:58:25 +0100
committerMartijn van Beurden <mvanb1@gmail.com>2022-04-13 17:37:50 +0200
commitdb72703f869df42dfef2deff764b70df2552092c (patch)
tree5a8b1970dbd1ef9f7a7a6b8aeeb0c2dd49298de2 /CMakeLists.txt
parent4256c12eacaefe77ce4236714f8b9259dec2dac0 (diff)
downloadflac-db72703f869df42dfef2deff764b70df2552092c.tar.gz
[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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6322c33b..5b103989 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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")