Skip to content

Commit

Permalink
fix meta cpp examples linking on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed Mar 6, 2018
1 parent 4999692 commit 6bdb1ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/meta/cpp/CMakeLists.txt
Expand Up @@ -6,6 +6,12 @@ FOREACH(META_EXAMPLE ${META_EXAMPLES})
# assume a structure <target_language>/<category>/listing.sg
GET_META_EXAMPLE_VARS(${META_EXAMPLE} EXAMPLE_NAME EXAMPLE_REL_DIR EXAMPLE_NAME_WITH_DIR)

if(WIN32)
SET(SHOGUN_LIBRARY shogun::shogun-static)
else()
SET(SHOGUN_LIBRARY shogun::shogun)
endif()

# meta examples have to be generated before executable and test is added
SET(GENERATED_CPP ${EXAMPLE_REL_DIR}/${EXAMPLE_NAME}.cpp)
SET(GENERATED_CPP_BINARY cpp-${EXAMPLE_REL_DIR}-${EXAMPLE_NAME})
Expand All @@ -14,10 +20,10 @@ FOREACH(META_EXAMPLE ${META_EXAMPLES})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXAMPLE_REL_DIR})

ADD_EXECUTABLE(${GENERATED_CPP_BINARY} ${GENERATED_CPP})
ADD_DEPENDENCIES(${GENERATED_CPP_BINARY} meta_examples shogun::shogun)
ADD_DEPENDENCIES(${GENERATED_CPP_BINARY} meta_examples ${SHOGUN_LIBRARY})
SET_SOURCE_FILES_PROPERTIES(${GENERATED_CPP} PROPERTIES GENERATED 1)

TARGET_LINK_LIBRARIES(${GENERATED_CPP_BINARY} shogun ${SANITIZER_LIBRARY})
TARGET_LINK_LIBRARIES(${GENERATED_CPP_BINARY} ${SHOGUN_LIBRARY} ${SANITIZER_LIBRARY})

# Suppress unused variable warnings
# if we are not testing the meta_examples
Expand Down

0 comments on commit 6bdb1ec

Please sign in to comment.