comparison CMakeLists.txt @ 264:38e9bb57f761

avoid race condition in CMake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 06 Jun 2020 11:37:56 +0200
parents 87ed513fff9d
children 4e9d30c19b4b
comparison
equal deleted inserted replaced
263:87ed513fff9d 264:38e9bb57f761
120 120
121 list(APPEND AUTOGENERATED_SOURCES ${AUTOGENERATED_DIR}/Version.rc) 121 list(APPEND AUTOGENERATED_SOURCES ${AUTOGENERATED_DIR}/Version.rc)
122 endif() 122 endif()
123 123
124 124
125 # As the "EmbeddedResources.(h|cpp)" are shared by both the
126 # "UnitTests" and the "OrthancWebViewer" targets, avoid race
127 # conditions in the code generation by adding a target between them
128 add_custom_target(
129 AutogeneratedTarget
130 DEPENDS
131 ${AUTOGENERATED_SOURCES}
132 )
133
125 set(CORE_SOURCES 134 set(CORE_SOURCES
126 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp 135 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheManager.cpp
127 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp 136 ${CMAKE_SOURCE_DIR}/Plugin/Cache/CacheScheduler.cpp
128 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp 137 ${CMAKE_SOURCE_DIR}/Plugin/ViewerToolbox.cpp
129 ${CMAKE_SOURCE_DIR}/Plugin/ViewerPrefetchPolicy.cpp 138 ${CMAKE_SOURCE_DIR}/Plugin/ViewerPrefetchPolicy.cpp
138 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp 147 ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp
139 ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp 148 ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp
140 ${CORE_SOURCES} 149 ${CORE_SOURCES}
141 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 150 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
142 ) 151 )
152
153 add_dependencies(OrthancWebViewer AutogeneratedTarget)
143 154
144 155
145 message("Setting the version of the library to ${ORTHANC_PLUGIN_VERSION}") 156 message("Setting the version of the library to ${ORTHANC_PLUGIN_VERSION}")
146 157
147 add_definitions(-DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}") 158 add_definitions(-DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}")
161 ${CORE_SOURCES} 172 ${CORE_SOURCES}
162 ${GOOGLE_TEST_SOURCES} 173 ${GOOGLE_TEST_SOURCES}
163 UnitTestsSources/UnitTestsMain.cpp 174 UnitTestsSources/UnitTestsMain.cpp
164 ) 175 )
165 176
177 add_dependencies(UnitTests AutogeneratedTarget)
178
166 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES}) 179 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES})