Hi,<br><br> I am attempting to migrate the ANN build to CMake for my own ease of cross platform maintenance.<br><br> The cmake configuration works fine on OSX but have problem Windows because of the additional linkage requirement.
<br><br> I understand that there is no per target DEFINITIONS setup so I'd like to hear advice from experience cmake user how I should configure my build.<br><br> The library needs the -DDLL_EXPORT while the application must not have that set so that it imports the exported symbols.
<br><br> At the moment, my build fails at the ann_test target because it inherits the -DDLL_EXPORT flag from the top.<br><br>Regards<br>
<br>8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------<br>PROJECT (ANN)<br><br>INCLUDE_DIRECTORIES ( ../include )<br><br>IF (WIN32)<br> ADD_DEFINITIONS ( -DDLL_EXPORTS -DANN_PERF -DANN_NO_RANDOM -D_CRT_SECURE_NO_DEPRECATE )
<br> SET ( LIBRARY_TYPE SHARED )<br>ELSE (WIN32)<br> SET ( LIBRARY_TYPE STATIC )<br>ENDIF (WIN32)<br><br>ADD_LIBRARY ( ANN ${LIBRARY_TYPE}<br> ../src/ANN.cpp<br> ../src/bd_fix_rad_search.cpp<br> ../src/bd_pr_search.cpp
<br> ../src/bd_search.cpp<br> ../src/bd_tree.cpp<br> ../src/brute.cpp<br> ../src/kd_dump.cpp<br> ../src/kd_fix_rad_search.cpp<br> ../src/kd_pr_search.cpp<br> ../src/kd_search.cpp<br> ../src/kd_split.cpp<br> ../src/kd_tree.cpp
<br> ../src/kd_util.cpp<br> ../src/perf.cpp<br> )<br><br>ADD_EXECUTABLE ( ann_test<br> ../test/ann_test.cpp<br> ../test/rand.cpp<br>)<br><br>ADD_EXECUTABLE ( ann_sample<br> ../sample/ann_sample.cpp<br>)<br><br>ADD_EXECUTABLE ( ann2fig
<br> ../ann2fig/ann2fig.cpp<br>)<br><br>TARGET_LINK_LIBRARIES ( ann_test ANN )<br><br>TARGET_LINK_LIBRARIES ( ann_sample ANN )<br><br>TARGET_LINK_LIBRARIES ( ann2fig ANN )<br><br>INSTALL ( TARGETS ann_test ann_sample ann2fig ANN
<br> RUNTIME DESTINATION bin<br> LIBRARY DESTINATION lib<br> ARCHIVE DESTINATION lib)<br><br><br>