Skip to content

Commit

Permalink
Fix build on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Vaneev <warchantua@gmail.com>
  • Loading branch information
Warchant committed Apr 7, 2018
1 parent 2b82cfd commit d7a0546
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Expand Up @@ -31,6 +31,10 @@ option(TESTING "Enable testing" OFF)
option(COVERAGE "Enable coverage" OFF)
option(BENCHMARKING "Enable benchmarking" OFF)

include_directories(
${CMAKE_BINARY_DIR}/
${CMAKE_SOURCE_DIR}/include/
)

include(GNUInstallDirs)
include(GenerateExportHeader)
Expand Down Expand Up @@ -135,8 +139,6 @@ ed25519_merge_libraries(ed25519 ${BUILD}
${EDIMPL}
${HASH}
${RANDOM}
COMPILE_OPTIONS
-Ded25519_EXPORTS=1
VERSION
VERSION-${SOVERSION}-${EDIMPL}-${HASH}-${RANDOM}-${BUILD}-${CMAKE_BUILD_TYPE}
)
Expand Down
1 change: 1 addition & 0 deletions cmake/ed25519_add_library.cmake
Expand Up @@ -43,6 +43,7 @@ function(ed25519_add_library LIBNAME TYPE)
)
target_compile_options(${LIBNAME} PUBLIC
${ARG_COMPILE_OPTIONS}
-Ded25519_EXPORTS
)
target_include_directories(${LIBNAME}
PUBLIC
Expand Down
10 changes: 3 additions & 7 deletions cmake/ed25519_add_test.cmake
Expand Up @@ -4,17 +4,13 @@ function(ed25519_add_test test_name)
gtest
gmock
)
target_include_directories(${test_name} PRIVATE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/;${CMAKE_BINARY_DIR}/ed25519;${CMAKE_SOURCE_DIR}/include/>
)
add_test(
NAME ${test_name}
COMMAND $<TARGET_FILE:${test_name}>
)

set_target_properties(${test_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
ARCHIVE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/static
LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test_bin
ARCHIVE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/test_lib
LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/test_lib
)
endfunction()
6 changes: 3 additions & 3 deletions cmake/ed25519_merge_libraries.cmake
Expand Up @@ -10,7 +10,7 @@ function(ed25519_merge_libraries TARGET LIBTYPE)
)

# create dummy C source file
set(${TARGET}_SRC ${CMAKE_BINARY_DIR}/${TARGET}_dummy.c)
set(${TARGET}_SRC ${CMAKE_BINARY_DIR}/dummy/${TARGET}_dummy.c)
configure_file_content("const char* libed25519_version = \"${ARG_VERSION}\";" ${${TARGET}_SRC})

# define target
Expand All @@ -22,11 +22,11 @@ function(ed25519_merge_libraries TARGET LIBTYPE)
)
target_compile_options(${TARGET} PUBLIC
${ARG_COMPILE_OPTIONS}
-Ded25519_EXPORTS
)
target_include_directories(${TARGET}
INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/;${CMAKE_SOURCE_DIR}/include/>
)

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Expand Down Expand Up @@ -56,6 +56,6 @@ function(ed25519_merge_libraries TARGET LIBTYPE)
set_target_properties(${TARGET} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
endfunction()
2 changes: 0 additions & 2 deletions cmake/ed25519_target_link_libraries.cmake
Expand Up @@ -23,8 +23,6 @@ function(ed25519_target_link_libraries _target)
message(FATAL_ERROR "${_target} is not target")
endif()



get_target_property(_type ${_target} TYPE)
if(_type STREQUAL "OBJECT_LIBRARY")
if(ARGN) # target_link_libraries may be empty, in this case ARGN will be empty
Expand Down

0 comments on commit d7a0546

Please sign in to comment.