catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.42k stars 3.02k forks source link

TARGET_OS_OSX not defined #2139

Open tdegeus opened 3 years ago

tdegeus commented 3 years ago

Building the latest release on for the conda feedstock, here https://github.com/conda-forge/catch2-feedstock/pull/37 , gives the following error on OSX:

[3/120] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o
FAILED: projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o 
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++  -I../include -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/catch2-2.13.4 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -O3 -DNDEBUG -isysroot /Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -Wall -Wextra -Wunreachable-code -Wpedantic -Wmissing-declarations -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn -MD -MT projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o -MF projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o.d -o projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o -c ../projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp
In file included from ../projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp:9:
In file included from ../include/internal/catch_test_case_tracker.h:11:
In file included from ../include/internal/catch_compiler_capabilities.h:28:
../include/internal/catch_platform.h:14:6: error: 'TARGET_OS_OSX' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_OSX]
# if TARGET_OS_OSX == 1
     ^
1 error generated.
tdegeus commented 3 years ago

It seems indeed that TARGET_OS_OSX is not part of TargetConditionals.h? See https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-8A428/TargetConditionals.h.auto.html

ryandesign commented 2 years ago

It's certainly not part of that 2004 Mac OS X 10.4-era version of TargetConditionals.h. It is part of later versions of TargetConditionals.h. I don't have a link for you. Your link to the old version was to CarbonHeaders; Carbon is ancient history. TargetConditionals.h is now undoubtedly considered part of some other macOS component, possibly one which is not posted to opensource.apple.com.

barracuda156 commented 1 year ago

@ryandesign Does 10.5 have it already? I never tested Catch2 on Tiger.

ryandesign commented 5 months ago

Does 10.5 have it already?

You can grep through the various SDK versions to determine when TARGET_OS_OSX came into existence just as well as I can, but it was added in order to distinguish macOS (which was called Mac OS X at the time) from iOS (which was iPhoneOS at the time). iPhone was introduced in 2007 but support for third-party apps was not added until iPhoneOS 2 in 2008.