More cmake work. That's enough of Visual Studio for now.
This commit is contained in:
parent
a3fe7edf3b
commit
0d88e5eb8b
|
@ -57,7 +57,9 @@ if(MSVC)
|
|||
else()
|
||||
endif()
|
||||
|
||||
# TODO why do I need to do this? why doesn't target_link_libraries() work?
|
||||
# problem:
|
||||
# - target_link_libraries() only supports - for flags
|
||||
# - but cmake only doesn't generate the manifest if the flag has a /
|
||||
macro(_target_link_options_private _target)
|
||||
foreach(_opt IN LISTS ${ARGN})
|
||||
set_property(TARGET ${_target} APPEND_STRING PROPERTY
|
||||
|
@ -120,3 +122,4 @@ macro(_add_exec _name)
|
|||
endif()
|
||||
endmacro()
|
||||
add_subdirectory("test")
|
||||
add_subdirectory("examples")
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# 3 june 2016
|
||||
|
||||
if(WIN32)
|
||||
set(_EXAMPLE_RESOURCES_RC resources.rc)
|
||||
endif()
|
||||
|
||||
macro(_add_example _name)
|
||||
_add_exec(${_name} ${ARGN})
|
||||
# because Microsoft's toolchain is dumb
|
||||
if(MSVC)
|
||||
set_property(TARGET ${_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " /ENTRY:mainCRTStartup")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_add_example(controlgallery
|
||||
controlgallery/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(histogram
|
||||
histogram/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(cpp-multithread
|
||||
cpp-multithread/main.cpp
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(cpp-multithread pthread)
|
||||
endif()
|
||||
|
||||
add_custom_target(examples
|
||||
DEPENDS
|
||||
controlgallery
|
||||
histogram
|
||||
cpp-multithread)
|
Loading…
Reference in New Issue