Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.4)
- project(Foo)
- include(GenerateExportHeader)
- file(WRITE foo.hpp [[
- #include "foo_export.h"
- class FOO_EXPORT Foo
- {
- public:
- Foo() {}
- static void my_static();
- };
- ]])
- file(WRITE foo.cpp [[
- #include "foo.hpp"
- void Foo::my_static()
- {
- }
- ]])
- add_library(foo SHARED foo.cpp foo.hpp)
- target_include_directories(foo PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
- generate_export_header(foo)
- file(WRITE bar.cpp [[
- #include "foo.hpp"
- int main()
- {
- Foo::my_static();
- Foo foo;
- }
- ]])
- add_executable(bar bar.cpp)
- target_link_libraries(bar PRIVATE foo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement