summaryrefslogtreecommitdiff
path: root/inject/CMakeLists.txt
blob: 6c24370d0f6ad819ceb0cdf8e36f673da88cb7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

include_directories (${CMAKE_SOURCE_DIR}/thirdparty/devcon)

add_library (injectee MODULE
    injectee.cpp
)
set_target_properties (injectee PROPERTIES
    PREFIX ""
)
if (MSVC)
    set_target_properties (injectee PROPERTIES LINK_FLAGS "/ENTRY:DllMainStartup")
else ()
    if (CMAKE_SIZEOF_VOID_P EQUAL 4)
        set_target_properties (injectee PROPERTIES LINK_FLAGS "-Wl,--entry=_DllMainStartup@12")
    else ()
        set_target_properties (injectee PROPERTIES LINK_FLAGS "-Wl,--entry=DllMainStartup")
    endif ()
endif ()

install (TARGETS injectee LIBRARY DESTINATION bin)
install_pdb (injectee DESTINATION bin)

add_executable (injector
    injector.cpp
)
set_target_properties (injector PROPERTIES
    OUTPUT_NAME inject
)
target_link_libraries (injector
    ${GETOPT_LIBRARIES}
    devcon
    psapi
)
install (TARGETS injector RUNTIME DESTINATION bin)
install_pdb (injector DESTINATION bin)