Skip to content

Commit c0c3dcb

Browse files
committed
Updates to compile on Ubuntu 16.04
1 parent e709092 commit c0c3dcb

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

IsoModel/src/CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project(isomodel_project)
22
set(target_name isomodel)
33

4-
cmake_minimum_required(VERSION 3.0)
4+
cmake_minimum_required(VERSION 3.1)
55

66
set(${target_name}_test
77
Test/HourlyModel_GTest.cpp
@@ -75,11 +75,15 @@ set(${target_name}_src
7575

7676
set (library_name isomodel)
7777

78+
# OR CMAKE_SYSTEM_NAME STREQUAL "Linux"
79+
7880
if(MSVC)
7981
set(Boost_USE_STATIC_LIBS ON)
8082
else()
81-
set(COMPILE_FLAGS "-std=c++11")
82-
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS})
83+
set(CMAKE_CXX_STANDARD 11)
84+
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS})
85+
# required for googletest
86+
FIND_PACKAGE ( Threads REQUIRED )
8387
endif()
8488

8589

@@ -109,7 +113,7 @@ target_link_libraries(${exec_name} ${${target_name}_depends})
109113

110114
add_executable(isomodel_unit_tests ${${target_name}_src} ${${target_name}_test})
111115
target_include_directories(isomodel_unit_tests PUBLIC ${GTEST_INCLUDE_DIRS})
112-
target_link_libraries(isomodel_unit_tests ${unit_test_depends})
116+
target_link_libraries(isomodel_unit_tests ${unit_test_depends} ${CMAKE_THREAD_LIBS_INIT})
113117

114118
add_executable(isomodel_benchmark ${${target_name}_src} ${${target_name}_benchmark})
115119
target_link_libraries(isomodel_benchmark ${benchmark_depends})
@@ -118,9 +122,9 @@ add_executable(solar_debug ${${target_name}_src} ${${target_name}_solar_debug})
118122
target_link_libraries(solar_debug ${${target_name}_depends})
119123

120124
# define USE_NEW_BUILDING_PARAMS if we are compiling the unit test target
121-
# this allows use to test parsing the as yet unused parameters
125+
# this allows use to test parsing the as yet unused parameters
122126
set_property(
123-
TARGET isomodel_unit_tests
127+
TARGET isomodel_unit_tests
124128
PROPERTY COMPILE_DEFINITIONS USE_NEW_BUILDING_PARAMS
125129
)
126130

@@ -134,6 +138,6 @@ add_custom_command(TARGET isomodel_unit_tests
134138
add_library(${library_name} SHARED ${${target_name}_src})
135139
target_link_libraries(${library_name} ${${target_name}_depends})
136140

137-
if (MSVC)
141+
if (MSVC)
138142
target_compile_options(${library_name} PRIVATE "-Dopenstudio_isomodel_EXPORTS")
139143
endif()

0 commit comments

Comments
 (0)