mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00

* Link test executables using system frameworks on Darwin
On an M1 MBP, running `cmake . && make test` yields the error
```
[ 69%] Linking CXX executable tc.t
Undefined symbols for architecture arm64:
"_CFRelease", referenced from:
_$LT$iana_time_zone..platform..system_time_zone..SystemTimeZone$u20$as$u20$core..ops..drop..Drop$GT$::drop::hcd3964de9573de30 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_CFStringGetBytes", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFStringGetCStringPtr", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::as_utf8::h8bb5c2c0d091ded1 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFStringGetLength", referenced from:
iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
"_CFTimeZoneCopySystem", referenced from:
iana_time_zone::platform::system_time_zone::SystemTimeZone:🆕:hc42d30609914d79d in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_CFTimeZoneGetName", referenced from:
iana_time_zone::platform::system_time_zone::SystemTimeZone::name::h44947ee6deb3339a in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
"_SecRandomCopyBytes", referenced from:
ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
"_kSecRandomDefault", referenced from:
ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test/tc.t] Error 1
make[2]: *** [test/CMakeFiles/tc.t.dir/all] Error 2
make[1]: *** [test/CMakeFiles/test.dir/rule] Error 2
```
This change resolves the error by updating the targets in
test/CMakeLists.txt to link against the CoreFoundation and Security
frameworks when building under Mac OS.
* Link executables against CoreFoundation and Security frameworks on Mac OS
* Rename test_osx.sh to test_macos.sh
---------
Co-authored-by: Dathan Bennett <dathanb@netflix.com>
44 lines
2.1 KiB
CMake
44 lines
2.1 KiB
CMake
cmake_minimum_required (VERSION 3.0)
|
|
|
|
# This is a work-around for the following CMake issue:
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/16062
|
|
# The issue has been fixed in CMake 3.11.0; the policy is set
|
|
# to OLD for compatibility with older versions of CMake only.
|
|
if(POLICY CMP0037 AND ${CMAKE_VERSION} VERSION_LESS "3.11.0")
|
|
cmake_policy(SET CMP0037 OLD)
|
|
endif()
|
|
|
|
include_directories (${CMAKE_SOURCE_DIR}
|
|
${CMAKE_SOURCE_DIR}/src
|
|
${CMAKE_SOURCE_DIR}/src/commands
|
|
${CMAKE_SOURCE_DIR}/src/columns
|
|
${CMAKE_SOURCE_DIR}/src/libshared/src
|
|
${CMAKE_SOURCE_DIR}/src/taskchampion/lib
|
|
${CMAKE_SOURCE_DIR}/test
|
|
${CMAKE_SOURCE_DIR}/taskchampion/lib
|
|
${TASK_INCLUDE_DIRS})
|
|
|
|
set (test_SRCS col.t dom.t eval.t lexer.t t.t tw-2689.t tdb2.t tc.t util.t variant_add.t variant_and.t variant_cast.t variant_divide.t variant_equal.t variant_exp.t variant_gt.t variant_gte.t variant_inequal.t variant_lt.t variant_lte.t variant_match.t variant_math.t variant_modulo.t variant_multiply.t variant_nomatch.t variant_not.t variant_or.t variant_partial.t variant_subtract.t variant_xor.t view.t)
|
|
|
|
add_custom_target (test ./run_all --verbose
|
|
DEPENDS ${test_SRCS} task_executable
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test)
|
|
|
|
add_custom_target (build_tests DEPENDS ${test_SRCS}
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
|
|
|
|
foreach (src_FILE ${test_SRCS})
|
|
add_executable (${src_FILE} "${src_FILE}.cpp" test.cpp)
|
|
target_link_libraries (${src_FILE} task tc commands columns libshared task tc tc-rust commands columns libshared task commands columns libshared ${TASK_LIBRARIES})
|
|
if (DARWIN)
|
|
target_link_libraries (${src_FILE} "-framework CoreFoundation -framework Security")
|
|
endif (DARWIN)
|
|
endforeach (src_FILE)
|
|
|
|
configure_file(run_all run_all COPYONLY)
|
|
configure_file(problems problems COPYONLY)
|
|
|
|
#SET(CMAKE_BUILD_TYPE gcov)
|
|
#SET(CMAKE_CXX_FLAGS_GCOV "--coverage")
|
|
#SET(CMAKE_C_FLAGS_GCOV "--coverage")
|
|
#SET(CMAKE_EXE_LINKER_FLAGS_GCOV "--coverage")
|