From 39ccc4fb11b52a3dbc18d50e19003cd9a708f623 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 8 May 2007 11:53:39 -0400 Subject: [PATCH] ENH: fix it so that the FRAMEWORK property does not break the building of normal shared libs on non-mac platforms --- Source/cmLocalGenerator.cxx | 5 +++++ Tests/Framework/CMakeLists.txt | 10 +++++----- Tests/Framework/bar.cxx | 5 ++++- Tests/Framework/foo.cxx | 6 ++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 747987196..05ba04d71 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1728,7 +1728,12 @@ void cmLocalGenerator // off the per-configuration subdirectory. The link directory // ordering knows how to deal with this. linkItem += tgt->GetDirectory(0, implib); + // on apple if the FRAMEWORK prop is set, then + // do not add the target full name but just use the directory + // name +#ifdef __APPLE__ if(!tgt->GetPropertyAsBool("FRAMEWORK")) +#endif { linkItem += "/"; linkItem += tgt->GetFullName(config, implib); diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index 3aac24dfe..74871bc55 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -1,11 +1,11 @@ project(Framework) add_library(foo SHARED foo.cxx) set_target_properties(foo PROPERTIES - FRAMEWORK TRUE - FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h" - FRAMEWORK_VERSION ver2 - FRAMEWORK_RESOURCES "" -# VERSION 1.2 + FRAMEWORK TRUE + FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h" + FRAMEWORK_VERSION ver2 + FRAMEWORK_RESOURCES "" ) add_executable(bar bar.cxx) target_link_libraries(bar foo) + diff --git a/Tests/Framework/bar.cxx b/Tests/Framework/bar.cxx index 37c132a0f..5c9d612c6 100644 --- a/Tests/Framework/bar.cxx +++ b/Tests/Framework/bar.cxx @@ -1,4 +1,7 @@ -void foo(); +#ifdef _WIN32 +# define CM_TEST_LIB_IMPORT __declspec( dllimport ) +#endif +CM_TEST_LIB_IMPORT void foo(); int main() { foo(); diff --git a/Tests/Framework/foo.cxx b/Tests/Framework/foo.cxx index 62acbb77c..521f6f21e 100644 --- a/Tests/Framework/foo.cxx +++ b/Tests/Framework/foo.cxx @@ -1,6 +1,8 @@ #include - -void foo() +#ifdef _WIN32 +# define CM_TEST_LIB_EXPORT __declspec( dllexport ) +#endif +CM_TEST_LIB_EXPORT void foo() { printf("foo\n"); }