forked from aminya/project_options
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aminya#134 from abeimler/feature/issue-133
- Loading branch information
Showing
7 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,3 +110,4 @@ words: | |
- "shlib" | ||
- "vcpkg" | ||
- cppdbg | ||
- mythirdpartylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include(GenerateExportHeader) | ||
|
||
add_subdirectory(mythirdpartylib) | ||
target_disable_static_analysis(mythirdpartylib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
add_library(mythirdpartylib STATIC src/Foo.cpp) | ||
generate_export_header(mythirdpartylib) | ||
|
||
target_include_directories(mythirdpartylib | ||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_include_directories(mythirdpartylib | ||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <string> | ||
|
||
#include "mythirdpartylib_export.h" | ||
|
||
namespace mythirdpartylib { | ||
|
||
class MYTHIRDPARTYLIB_EXPORT Foo { | ||
public: | ||
Foo() = default; | ||
|
||
/*implicit*/ Foo(int a) : m_a(a) {} | ||
|
||
int a() const { return m_a; } | ||
|
||
void update(bool b, bool c, bool d); | ||
void bad(std::vector<std::string>& v); | ||
|
||
private: | ||
int m_a; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "Foo.hpp" | ||
|
||
namespace mythirdpartylib { | ||
|
||
void Foo::update(bool b, bool c, bool d) { | ||
int e = b + d; | ||
m_a = e; | ||
} | ||
|
||
void Foo::bad(std::vector<std::string>& v) { | ||
std::string val = "hello"; | ||
int index = -1; // bad, plus should use gsl::index | ||
for (int i = 0; i < v.size(); ++i) { | ||
if (v[i] == val) { | ||
index = i; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
static Foo foo (5); | ||
static Foo bar = 42; | ||
|
||
} |