summaryrefslogtreecommitdiff
path: root/examples/breakpoint
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-02-01 16:34:18 -0500
committerGlenn Smith <glenn@vector35.com>2022-02-02 19:22:08 -0500
commitb8af211f9a3647687c7e45c0fd04b0768df87ffe (patch)
tree64f13fe262399189d70aadf33e1c6e33f0a74c3e /examples/breakpoint
parent5f5785fd2b1cee6bc9a082e1209de00b1497d410 (diff)
Fancier CMake: find scripts, out-of-tree example builds
Diffstat (limited to 'examples/breakpoint')
-rw-r--r--examples/breakpoint/CMakeLists.txt13
-rw-r--r--examples/breakpoint/Makefile.win16
2 files changed, 12 insertions, 17 deletions
diff --git a/examples/breakpoint/CMakeLists.txt b/examples/breakpoint/CMakeLists.txt
index 0ec4cb0d..8ede6524 100644
--- a/examples/breakpoint/CMakeLists.txt
+++ b/examples/breakpoint/CMakeLists.txt
@@ -1,10 +1,21 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
-project(breakpoint CXX)
+project(breakpoint CXX C)
add_library(${PROJECT_NAME} SHARED
src/breakpoint.cpp)
+if(NOT BN_API_BUILD_EXAMPLES)
+ # Out-of-tree build
+ find_path(
+ BN_API_DIR
+ NAMES binaryninjaapi.h
+ HINTS ../.. binaryninjaapi $ENV{BN_API_DIR}
+ REQUIRED
+ )
+ add_subdirectory(${BN_API_DIR} api)
+endif()
+
target_link_libraries(${PROJECT_NAME}
binaryninjaapi)
diff --git a/examples/breakpoint/Makefile.win b/examples/breakpoint/Makefile.win
deleted file mode 100644
index 00cbbfa1..00000000
--- a/examples/breakpoint/Makefile.win
+++ /dev/null
@@ -1,16 +0,0 @@
-BINJA_API_INC_PATH = ..\..\
-BINJA_API_LIB = ..\..\bin\libbinaryninjaapi.lib
-BINJA_CORE_LIB = "c:\Program Files\Vector35\BinaryNinja\binaryninjacore.lib"
-
-FLAGS = /DWIN32 /D__WIN32__ /EHsc /I$(BINJA_API_INC_PATH) /link $(BINJA_API_LIB) $(BINJA_CORE_LIB)
-
-bininfo.dll: ./src/breakpoint.cpp
- if not exist bin mkdir bin
- cl ./src/breakpoint.cpp /LD $(FLAGS) /OUT:.\bin\breakpoint.dll
-
-clean:
- if exist *.obj del *.obj
- if exist *.exp del *.exp
- if exist *.lib del *.lib
- if exist *.dll del *.dll
- if exist .\bin del /S /Q bin