diff options
author | Brad King <brad.king@kitware.com> | 2009-10-21 13:01:17 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-10-21 13:01:17 -0400 |
commit | e4897a78b9a325537117a57243c65d82774694fc (patch) | |
tree | 4ed2cbc49125bd9b28d70393bba34ca89f3bbe30 /Tests/Architecture | |
parent | 2dc39b8c329425cb54e5e111e2b00d79caa1db36 (diff) | |
download | cmake-e4897a78b9a325537117a57243c65d82774694fc.tar.gz |
Test OSX_ARCHITECTURES target property
We test the property with a project that fails to link due to an
architecture mismatch between an executable and a static library.
See issue #8725.
Diffstat (limited to 'Tests/Architecture')
-rw-r--r-- | Tests/Architecture/CMakeLists.txt | 21 | ||||
-rw-r--r-- | Tests/Architecture/bar.c | 2 | ||||
-rw-r--r-- | Tests/Architecture/foo.c | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt new file mode 100644 index 0000000000..bc767fe3dc --- /dev/null +++ b/Tests/Architecture/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8) +project(Architecture C) + +add_library(foo foo.c) +if(CMAKE_OSX_ARCHITECTURES) + get_property(archs TARGET foo PROPERTY OSX_ARCHITECTURES) + if(NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "${archs}") + message(FATAL_ERROR + "OSX_ARCHITECTURES property not initialized by CMAKE_OSX_ARCHITECTURES.\n" + "Expected [${CMAKE_OSX_ARCHITECTURES}], got [${archs}]." + ) + endif() +endif() +set_property(TARGET foo PROPERTY OSX_ARCHITECTURES i386) +set_property(TARGET foo PROPERTY OSX_ARCHITECTURES_DEBUG ppc) + +add_executable(bar bar.c) +target_link_libraries(bar foo) +set_property(TARGET bar PROPERTY OUTPUT_NAME Architecture) +set_property(TARGET bar PROPERTY OSX_ARCHITECTURES ppc) +set_property(TARGET bar PROPERTY OSX_ARCHITECTURES_DEBUG i386) diff --git a/Tests/Architecture/bar.c b/Tests/Architecture/bar.c new file mode 100644 index 0000000000..923c89c9a6 --- /dev/null +++ b/Tests/Architecture/bar.c @@ -0,0 +1,2 @@ +extern int foo(void); +int main() { return foo(); } diff --git a/Tests/Architecture/foo.c b/Tests/Architecture/foo.c new file mode 100644 index 0000000000..e35694ba00 --- /dev/null +++ b/Tests/Architecture/foo.c @@ -0,0 +1 @@ +int foo(void) { return 0; } |