Issue
Get TestInstall to work on Windows
MODIFY
tests/TestInstall/CMakeLists.txt
tests/TestInstall/CMakeLists.txt
# -*- mode:cmake -*-
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.15)
# Usage:
# After a make install at the top drectory:
@@ -13,7 +13,13 @@ cmake_minimum_required(VERSION 3.13)
project(HELLOSUREWORLD)
+# NOTE: Policy changes has to happen before adding any subprojects
+cmake_policy(SET CMP0091 NEW)
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+
set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Python
find_package(Python3 3.3 REQUIRED COMPONENTS Interpreter Development)
@@ -34,8 +40,13 @@ if(NOT NO_TCMALLOC)
endif(NOT NO_TCMALLOC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TCMALLOC_COMPILE_OPTIONS} ${MY_CXX_WARNING_FLAGS}")
+if(MSVC)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W0 /bigobj ${MY_CXX_WARNING_FLAGS}")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W0 /bigobj ${MY_CXX_WARNING_FLAGS}")
+else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${TCMALLOC_COMPILE_OPTIONS} -Wall -O0 -g ${MY_CXX_WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} -Wall -O3 -DNDEBUG ${MY_CXX_WARNING_FLAGS}")
+endif()
set (INCLUDE_DIR "${INSTALL_DIR}/include/surelog/")
@@ -49,16 +60,31 @@ if(NOT NO_TCMALLOC)
set (TCMALLOC_LIBRARY tcmalloc)
endif(NOT NO_TCMALLOC)
-set (INSTALL_LIBRARIES_FOR_SURELOG
- -L${LIB_DIR}surelog/ surelog
- antlr4-runtime
+add_executable(test_hellosureworld ${PROJECT_SOURCE_DIR}/../../src/hellosureworld.cpp)
+
+target_link_directories(test_hellosureworld
+ PRIVATE ${LIB_DIR}surelog/
+ PRIVATE ${LIB_DIR}uhdm/
+)
+
+target_link_libraries(test_hellosureworld
+ surelog
+ antlr4-runtime$<$<CXX_COMPILER_ID:MSVC>:-static>
flatbuffers
uhdm
- -L${LIB_DIR}uhdm/
- capnp kj
- ${Python3_LIBRARIES} dl util m rt pthread ${TCMALLOC_LIBRARY}
+ capnp
+ kj
+ ${Python3_LIBRARIES}
+ ${TCMALLOC_LIBRARY}
)
-add_executable(test_hellosureworld ${PROJECT_SOURCE_DIR}/../../src/hellosureworld.cpp)
-target_link_libraries(test_hellosureworld ${INSTALL_LIBRARIES_FOR_SURELOG})
-target_link_libraries(test_hellosureworld stdc++fs)
+if (UNIX)
+ target_link_libraries(test_hellosureworld
+ stdc++fs
+ dl
+ util
+ m
+ rt
+ pthread
+ )
+endif()
\ No newline at end of file

Issue #239
Get TestInstall to work on Windows