ENH: fix it so that the FRAMEWORK property does not break the building of normal shared libs on non-mac platforms

This commit is contained in:
Bill Hoffman 2007-05-08 11:53:39 -04:00
parent e6b8aa496a
commit 39ccc4fb11
4 changed files with 18 additions and 8 deletions

View File

@ -1728,7 +1728,12 @@ void cmLocalGenerator
// off the per-configuration subdirectory. The link directory // off the per-configuration subdirectory. The link directory
// ordering knows how to deal with this. // ordering knows how to deal with this.
linkItem += tgt->GetDirectory(0, implib); 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")) if(!tgt->GetPropertyAsBool("FRAMEWORK"))
#endif
{ {
linkItem += "/"; linkItem += "/";
linkItem += tgt->GetFullName(config, implib); linkItem += tgt->GetFullName(config, implib);

View File

@ -1,11 +1,11 @@
project(Framework) project(Framework)
add_library(foo SHARED foo.cxx) add_library(foo SHARED foo.cxx)
set_target_properties(foo PROPERTIES set_target_properties(foo PROPERTIES
FRAMEWORK TRUE FRAMEWORK TRUE
FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h" FRAMEWORK_PUBLIC_HEADERS "foo.h;foo2.h"
FRAMEWORK_VERSION ver2 FRAMEWORK_VERSION ver2
FRAMEWORK_RESOURCES "" FRAMEWORK_RESOURCES ""
# VERSION 1.2
) )
add_executable(bar bar.cxx) add_executable(bar bar.cxx)
target_link_libraries(bar foo) target_link_libraries(bar foo)

View File

@ -1,4 +1,7 @@
void foo(); #ifdef _WIN32
# define CM_TEST_LIB_IMPORT __declspec( dllimport )
#endif
CM_TEST_LIB_IMPORT void foo();
int main() int main()
{ {
foo(); foo();

View File

@ -1,6 +1,8 @@
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32
void foo() # define CM_TEST_LIB_EXPORT __declspec( dllexport )
#endif
CM_TEST_LIB_EXPORT void foo()
{ {
printf("foo\n"); printf("foo\n");
} }