[waffle] [PATCH 46/53] cmake: Set default location for all artifacts to top-level directories
Emil Velikov
emil.l.velikov at gmail.com
Sun Nov 9 14:58:51 PST 2014
By default, put executables into $CMAKE_BINARY_DIR/bin and libraries
into $CMAKE_BINARY_DIR/lib. Test executables still go into
$CMAKE_BINARY_DIR/test.
This patch's main purpose is to consolidate repetitive code. It doesn't
actually move anything except 'libcmocka.a'.
v2: [Emil]
- Move gl_basic_test (dynamic linked against waffle) to bin, or the
test will fail on Windows. Due to the DLL being in a different folder.
Cc: Emil Velikov <emil.l.velikov at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
.gitignore | 2 +-
CMakeLists.txt | 7 +++++++
src/utils/CMakeLists.txt | 4 ----
src/waffle/CMakeLists.txt | 3 ---
tests/functional/CMakeLists.txt | 7 -------
5 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/.gitignore b/.gitignore
index 85a607f..7944c00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,7 @@ Makefile
*.a
*.so
+/bin/gl_basic_test
/bin/wflinfo
/doc/html/man/waffle.7.html
/doc/html/man/waffle_attrib_list.3.html
@@ -57,7 +58,6 @@ Makefile
/lib/
/libcmocka.a
/src/waffle/libwaffle_static.a
-/tests/functional/gl_basic_test
/tests/waffle_test/libwaffle_test.dylib
/tests/unittests/waffle-unittest
/tests/wcore_attrib_list_unittest
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6c804b..bde8096 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,13 @@ cmake_minimum_required(VERSION 2.8.11)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
+# Set the default location for all build artifacts to traditionally named
+# top-level directories. CMake's default location for build artifacts varies
+# per artifact and is hard-to-guess.
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
+
include(WaffleDefineOS)
include(WaffleFindDependencies)
include(Options.cmake)
diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt
index 6744c78..9cb6cc7 100644
--- a/src/utils/CMakeLists.txt
+++ b/src/utils/CMakeLists.txt
@@ -4,10 +4,6 @@
add_executable(wflinfo wflinfo.c)
target_link_libraries(wflinfo ${waffle_libname} ${GETOPT_LIBRARIES})
-set_target_properties(wflinfo
- PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
- )
if(waffle_on_mac)
set_target_properties(wflinfo
diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index 891ff80..b580960 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -216,8 +216,6 @@ target_link_libraries(${waffle_libname} PRIVATE ${waffle_libdeps})
set_target_properties(${waffle_libname}
PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
SOVERSION ${waffle_soversion}
VERSION ${waffle_soversion}.${waffle_minor_version}.${waffle_patch_version}
)
@@ -258,7 +256,6 @@ target_link_libraries(waffle_static ${waffle_libdeps})
set_target_properties(waffle_static
PROPERTIES
OUTPUT_NAME "waffle-${waffle_major_version}"
- ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)
# ----------------------------------------------------------------------------
diff --git a/tests/functional/CMakeLists.txt b/tests/functional/CMakeLists.txt
index 0612829..f1388b2 100644
--- a/tests/functional/CMakeLists.txt
+++ b/tests/functional/CMakeLists.txt
@@ -29,13 +29,6 @@ add_executable(gl_basic_test
${gl_basic_test_sources}
)
-# Ensure that the executable is in the same folder as the library it's linked
-# against. Otherwise Windows will fail to load the DLL, and the test will fail.
-set_target_properties(gl_basic_test
- PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
-)
-
target_link_libraries(gl_basic_test
${waffle_libname}
waffle_test
--
2.1.3
More information about the waffle
mailing list