Handle the case where the user changes the DEFINE_SYMBOL property.

This eases porting of KDE code.
This commit is contained in:
Stephen Kelly
2011-08-08 02:08:10 +02:00
parent 30880707c0
commit def0a54e0a
7 changed files with 44 additions and 1 deletions

View File

@@ -107,6 +107,8 @@ macro_add_test_library(libstatic)
add_subdirectory(lib_shared_and_static)
add_subdirectory(lib_shared_and_statictest)
add_subdirectory(override_symbol)
if (CMAKE_COMPILER_IS_GNUCXX)
# We deliberately call deprecated methods, and test for that elsewhere.
# No need to clutter the test output with warnings.

View File

@@ -0,0 +1,11 @@
project(override_symbol)
add_library(somelib SHARED someclass.cpp)
set_target_properties(somelib PROPERTIES DEFINE_SYMBOL SOMELIB_MAKEDLL)
generate_export_header(somelib)
add_executable(consumer main.cpp)
target_link_libraries(consumer somelib)

View File

@@ -0,0 +1,9 @@
#include "someclass.h"
int main(int, char**)
{
SomeClass sc;
sc.someMethod();
return 0;
}

View File

@@ -0,0 +1,7 @@
#include "someclass.h"
void SomeClass::someMethod() const
{
}

View File

@@ -0,0 +1,8 @@
#include "somelib_export.h"
class SOMELIB_EXPORT SomeClass
{
public:
void someMethod() const;
};