diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2014-11-02 13:23:11 -0800 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2014-11-02 13:23:15 -0800 |
commit | cb0abd8573e7c2e796aa0267cc65f090134ac3a2 (patch) | |
tree | 89155dd98e2350d380daa6577885ceed378aeea8 | |
parent | 1d0ff7edd41b1da62c68a339adfca6480e13497e (diff) |
CMake/build.cmake : Fix for CMake 3.0.2.
Previous versions of CMake allowed targets names like "tests/win32_test"
but CMake 3.0.2 doesn't. The corresponding target name for the new CMake
is "win32_test", but putting the resulting executable in the tests/
directory requires something like:
add_executable (win32_test tests/win32_test.c)
set_target_properties (win32_test
PROPERTIES RUNTIME_OUTPUT_DIRECTORY tests)
-rw-r--r-- | CMake/build.cmake | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/CMake/build.cmake b/CMake/build.cmake index 2c113c7..df48af8 100644 --- a/CMake/build.cmake +++ b/CMake/build.cmake @@ -1,55 +1,62 @@ # Build recipe for building programs in the programs/ directory. function (lsf_build_program prog_name extra_libs) - add_executable (programs/${prog_name} + add_executable (${prog_name} programs/common.c programs/${prog_name}.c ) - target_link_libraries (programs/${prog_name} sndfile ${extra_libs}) + target_link_libraries (${prog_name} sndfile ${extra_libs}) + set_target_properties (${prog_name} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY programs + ) endfunction () # Build recipe for building C tests in the src/ directory. function (lsf_build_src_test_c test_name extra_files) - add_executable (src/${test_name} + add_executable (${test_name} src/${test_name}.c ${extra_files} ) - target_link_libraries (src/${test_name} m) - set_target_properties (src/${test_name} + target_link_libraries (${test_name} m) + set_target_properties (${test_name} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE EXCLUDE_FROM_ALL TRUE + RUNTIME_OUTPUT_DIRECTORY src ) - add_dependencies (check src/${test_name}) + add_dependencies (check ${test_name}) endfunction () # Build recipe for building C tests in the tests/ directory. function (lsf_build_test_c test_name extra_files) - add_executable (tests/${test_name} - tests/utils.c + add_executable (${test_name} tests/${test_name}.c + tests/utils.c ${extra_files} ) - target_link_libraries (tests/${test_name} sndfile) - set_target_properties (tests/${test_name} + target_link_libraries (${test_name} sndfile) + set_target_properties (${test_name} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE EXCLUDE_FROM_ALL TRUE + RUNTIME_OUTPUT_DIRECTORY tests ) - add_dependencies (check tests/${test_name}) + add_dependencies (check ${test_name}) endfunction () # Build recipe for building C++ tests in the tests/ directory. function (lsf_build_test_cc test_name) - add_executable (tests/${test_name} + add_executable (${test_name} tests/utils.c tests/${test_name}.cc ) - target_link_libraries (tests/${test_name} sndfile) - set_target_properties (tests/${test_name} + target_link_libraries (${test_name} sndfile) + set_target_properties (${test_name} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE EXCLUDE_FROM_ALL TRUE + RUNTIME_OUTPUT_DIRECTORY tests ) - add_dependencies (check tests/${test_name}) + add_dependencies (check ${test_name}) endfunction () |